GCC Code Coverage Report


Directory: ./
File: cbld/sql_yacc.yy
Date: 2022-11-26 14:12:44
Exec Total Coverage
Lines: 4710 5318 88.6%
Branches: 4170 7944 52.5%

Line Branch Exec Source
1 /*
2 Copyright (c) 2000, 2022, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is also distributed with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have included with MySQL.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24 /* sql_yacc.yy */
25
26 /**
27 @defgroup Parser Parser
28 @{
29 */
30
31 %{
32 /*
33 Note: YYTHD is passed as an argument to yyparse(), and subsequently to yylex().
34 */
35 #define YYP (YYTHD->m_parser_state)
36 #define YYLIP (& YYTHD->m_parser_state->m_lip)
37 #define YYPS (& YYTHD->m_parser_state->m_yacc)
38 #define YYCSCL (YYLIP->query_charset)
39 #define YYMEM_ROOT (YYTHD->mem_root)
40 #define YYCLIENT_NO_SCHEMA (YYTHD->get_protocol()->has_client_capability(CLIENT_NO_SCHEMA))
41
42 #define YYINITDEPTH 100
43 #define YYMAXDEPTH 3200 /* Because of 64K stack */
44 #define Lex (YYTHD->lex)
45 #define Select Lex->current_query_block()
46
47 #include <sys/types.h> // TODO: replace with cstdint
48
49 #include <algorithm>
50 #include <cerrno>
51 #include <climits>
52 #include <cstdlib>
53 #include <cstring>
54 #include <limits>
55 #include <memory>
56 #include <string>
57 #include <type_traits>
58 #include <utility>
59
60 #include "field_types.h"
61 #include "ft_global.h"
62 #include "lex_string.h"
63 #include "libbinlogevents/include/binlog_event.h"
64 #include "m_ctype.h"
65 #include "m_string.h"
66 #include "my_alloc.h"
67 #include "my_base.h"
68 #include "my_check_opt.h"
69 #include "my_dbug.h"
70 #include "my_inttypes.h" // TODO: replace with cstdint
71 #include "my_sqlcommand.h"
72 #include "my_sys.h"
73 #include "my_thread_local.h"
74 #include "my_time.h"
75 #include "myisam.h"
76 #include "myisammrg.h"
77 #include "mysql/mysql_lex_string.h"
78 #include "mysql/plugin.h"
79 #include "mysql/udf_registration_types.h"
80 #include "mysql_com.h"
81 #include "mysql_time.h"
82 #include "mysqld_error.h"
83 #include "prealloced_array.h"
84 #include "sql/auth/auth_acls.h"
85 #include "sql/auth/auth_common.h"
86 #include "sql/binlog.h" // for MAX_LOG_UNIQUE_FN_EXT
87 #include "sql/create_field.h"
88 #include "sql/dd/types/abstract_table.h" // TT_BASE_TABLE
89 #include "sql/dd/types/column.h"
90 #include "sql/derror.h"
91 #include "sql/event_parse_data.h"
92 #include "sql/field.h"
93 #include "sql/gis/srid.h" // gis::srid_t
94 #include "sql/handler.h"
95 #include "sql/item.h"
96 #include "sql/item_cmpfunc.h"
97 #include "sql/item_create.h"
98 #include "sql/item_func.h"
99 #include "sql/item_geofunc.h"
100 #include "sql/item_json_func.h"
101 #include "sql/item_regexp_func.h"
102 #include "sql/item_row.h"
103 #include "sql/item_strfunc.h"
104 #include "sql/item_subselect.h"
105 #include "sql/item_sum.h"
106 #include "sql/item_timefunc.h"
107 #include "sql-common/json_dom.h"
108 #include "sql-common/json_syntax_check.h" // is_valid_json_syntax
109 #include "sql/key_spec.h"
110 #include "sql/keycaches.h"
111 #include "sql/lex_symbol.h"
112 #include "sql/lex_token.h"
113 #include "sql/lexer_yystype.h"
114 #include "sql/mdl.h"
115 #include "sql/mem_root_array.h"
116 #include "sql/mysqld.h"
117 #include "sql/options_mysqld.h"
118 #include "sql/parse_location.h"
119 #include "sql/parse_tree_helpers.h"
120 #include "sql/parse_tree_node_base.h"
121 #include "sql/parser_yystype.h"
122 #include "sql/partition_element.h"
123 #include "sql/partition_info.h"
124 #include "sql/protocol.h"
125 #include "sql/query_options.h"
126 #include "sql/resourcegroups/platform/thread_attrs_api.h"
127 #include "sql/resourcegroups/resource_group_basic_types.h"
128 #include "sql/rpl_filter.h"
129 #include "sql/rpl_replica.h" // Sql_cmd_change_repl_filter
130 #include "sql/set_var.h"
131 #include "sql/sp.h"
132 #include "sql/sp_head.h"
133 #include "sql/sp_instr.h"
134 #include "sql/sp_pcontext.h"
135 #include "sql/spatial.h"
136 #include "sql/sql_admin.h" // Sql_cmd_analyze/Check..._table
137 #include "sql/sql_alter.h" // Sql_cmd_alter_table*
138 #include "sql/sql_backup_lock.h" // Sql_cmd_lock_instance
139 #include "sql/sql_class.h" /* Key_part_spec, enum_filetype */
140 #include "sql/sql_cmd_srs.h"
141 #include "sql/sql_connect.h"
142 #include "sql/sql_component.h"
143 #include "sql/sql_error.h"
144 #include "sql/sql_exchange.h"
145 #include "sql/sql_get_diagnostics.h" // Sql_cmd_get_diagnostics
146 #include "sql/sql_handler.h" // Sql_cmd_handler_*
147 #include "sql/sql_import.h" // Sql_cmd_import_table
148 #include "sql/sql_lex.h"
149 #include "sql/sql_list.h"
150 #include "sql/sql_parse.h" /* comp_*_creator */
151 #include "sql/sql_plugin.h" // plugin_is_ready
152 #include "sql/sql_profile.h"
153 #include "sql/sql_select.h" // Sql_cmd_select...
154 #include "sql/sql_servers.h"
155 #include "sql/sql_signal.h"
156 #include "sql/sql_table.h" /* primary_key_name */
157 #include "sql/sql_tablespace.h" // Sql_cmd_alter_tablespace
158 #include "sql/sql_trigger.h" // Sql_cmd_create_trigger
159 #include "sql/sql_udf.h"
160 #include "sql/system_variables.h"
161 #include "sql/table.h"
162 #include "sql/table_function.h"
163 #include "sql/thr_malloc.h"
164 #include "sql/trigger_def.h"
165 #include "sql/window_lex.h"
166 #include "sql/xa/sql_cmd_xa.h" // Sql_cmd_xa...
167 #include "sql_chars.h"
168 #include "sql_string.h"
169 #include "thr_lock.h"
170 #include "violite.h"
171
172 /* this is to get the bison compilation windows warnings out */
173 #ifdef _MSC_VER
174 /* warning C4065: switch statement contains 'default' but no 'case' labels */
175 #pragma warning (disable : 4065)
176 #endif
177
178 using std::min;
179 using std::max;
180
181 /// The maximum number of histogram buckets.
182 static const int MAX_NUMBER_OF_HISTOGRAM_BUCKETS= 1024;
183
184 /// The default number of histogram buckets when the user does not specify it
185 /// explicitly. A value of 100 is chosen because the gain in accuracy above this
186 /// point seems to be generally low.
187 static const int DEFAULT_NUMBER_OF_HISTOGRAM_BUCKETS= 100;
188
189 int yylex(void *yylval, void *yythd);
190
191 #define yyoverflow(A,B,C,D,E,F,G,H) \
192 { \
193 ulong val= *(H); \
194 if (my_yyoverflow((B), (D), (F), &val)) \
195 { \
196 yyerror(NULL, YYTHD, NULL, (const char*) (A));\
197 return 2; \
198 } \
199 else \
200 { \
201 *(H)= (YYSIZE_T)val; \
202 } \
203 }
204
205 #define MYSQL_YYABORT YYABORT
206
207 #define MYSQL_YYABORT_ERROR(...) \
208 do \
209 { \
210 my_error(__VA_ARGS__); \
211 MYSQL_YYABORT; \
212 } while(0)
213
214 #define MYSQL_YYABORT_UNLESS(A) \
215 if (!(A)) \
216 { \
217 YYTHD->syntax_error(); \
218 MYSQL_YYABORT; \
219 }
220
221 #define NEW_PTN new(YYMEM_ROOT)
222
223
224 /**
225 Parse_tree_node::contextualize() function call wrapper
226 */
227 #define CONTEXTUALIZE(x) \
228 do \
229 { \
230 std::remove_reference<decltype(*x)>::type::context_t pc(YYTHD, Select); \
231 if (YYTHD->is_error() || \
232 (YYTHD->lex->will_contextualize && (x)->contextualize(&pc))) \
233 MYSQL_YYABORT; \
234 } while(0)
235
236
237 /**
238 Item::itemize() function call wrapper
239 */
240 #define ITEMIZE(x, y) \
241 do \
242 { \
243 Parse_context pc(YYTHD, Select); \
244 if (YYTHD->is_error() || \
245 (YYTHD->lex->will_contextualize && (x)->itemize(&pc, (y)))) \
246 MYSQL_YYABORT; \
247 } while(0)
248
249 /**
250 Parse_tree_root::make_cmd() wrapper to raise postponed error message on OOM
251
252 @note x may be NULL because of OOM error.
253 */
254 #define MAKE_CMD(x) \
255 do \
256 { \
257 if (YYTHD->is_error() || Lex->make_sql_cmd(x)) \
258 MYSQL_YYABORT; \
259 } while(0)
260
261
262 #ifndef NDEBUG
263 #define YYDEBUG 1
264 #else
265 #define YYDEBUG 0
266 #endif
267
268
269 /**
270 @brief Bison callback to report a syntax/OOM error
271
272 This function is invoked by the bison-generated parser
273 when a syntax error or an out-of-memory
274 condition occurs, then the parser function MYSQLparse()
275 returns 1 to the caller.
276
277 This function is not invoked when the
278 parser is requested to abort by semantic action code
279 by means of YYABORT or YYACCEPT macros..
280
281 This function is not for use in semantic actions and is internal to
282 the parser, as it performs some pre-return cleanup.
283 In semantic actions, please use syntax_error or my_error to
284 push an error into the error stack and MYSQL_YYABORT
285 to abort from the parser.
286 */
287
288 static
289 3533 void MYSQLerror(YYLTYPE *location, THD *thd, Parse_tree_root **, const char *s)
290 {
291
1/2
✓ Branch 0 taken 3533 times.
✗ Branch 1 not taken.
3533 if (strcmp(s, "syntax error") == 0) {
292 3533 thd->syntax_error_at(*location);
293 } else if (strcmp(s, "memory exhausted") == 0) {
294 my_error(ER_DA_OOM, MYF(0));
295 } else {
296 // Find omitted error messages in the generated file (sql_yacc.cc) and fix:
297 assert(false);
298 my_error(ER_UNKNOWN_ERROR, MYF(0));
299 }
300 3533 }
301
302
303 #ifndef NDEBUG
304 void turn_parser_debug_on()
305 {
306 /*
307 MYSQLdebug is in sql/sql_yacc.cc, in bison generated code.
308 Turning this option on is **VERY** verbose, and should be
309 used when investigating a syntax error problem only.
310
311 The syntax to run with bison traces is as follows :
312 - Starting a server manually :
313 mysqld --debug="d,parser_debug" ...
314 - Running a test :
315 mysql-test-run.pl --mysqld="--debug=d,parser_debug" ...
316
317 The result will be in the process stderr (var/log/master.err)
318 */
319
320 extern int yydebug;
321 yydebug= 1;
322 }
323 #endif
324
325 88085 static bool is_native_function(const LEX_STRING &name)
326 {
327
2/2
✓ Branch 0 taken 4501 times.
✓ Branch 1 taken 83584 times.
88085 if (find_native_function_builder(name) != nullptr)
328 4501 return true;
329
330
2/2
✓ Branch 0 taken 11 times.
✓ Branch 1 taken 83573 times.
83584 if (is_lex_native_function(&name))
331 11 return true;
332
333 83573 return false;
334 }
335
336
337 /**
338 Helper action for a case statement (entering the CASE).
339 This helper is used for both 'simple' and 'searched' cases.
340 This helper, with the other case_stmt_action_..., is executed when
341 the following SQL code is parsed:
342 <pre>
343 CREATE PROCEDURE proc_19194_simple(i int)
344 BEGIN
345 DECLARE str CHAR(10);
346
347 CASE i
348 WHEN 1 THEN SET str="1";
349 WHEN 2 THEN SET str="2";
350 WHEN 3 THEN SET str="3";
351 ELSE SET str="unknown";
352 END CASE;
353
354 SELECT str;
355 END
356 </pre>
357 The actions are used to generate the following code:
358 <pre>
359 SHOW PROCEDURE CODE proc_19194_simple;
360 Pos Instruction
361 0 set str@1 NULL
362 1 set_case_expr (12) 0 i@0
363 2 jump_if_not 5(12) (case_expr@0 = 1)
364 3 set str@1 _latin1'1'
365 4 jump 12
366 5 jump_if_not 8(12) (case_expr@0 = 2)
367 6 set str@1 _latin1'2'
368 7 jump 12
369 8 jump_if_not 11(12) (case_expr@0 = 3)
370 9 set str@1 _latin1'3'
371 10 jump 12
372 11 set str@1 _latin1'unknown'
373 12 stmt 0 "SELECT str"
374 </pre>
375
376 @param thd thread handler
377 */
378
379 1360 static void case_stmt_action_case(THD *thd)
380 {
381 1360 LEX *lex= thd->lex;
382 1360 sp_head *sp= lex->sphead;
383 1360 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
384
385 1360 sp->m_parser_data.new_cont_backpatch();
386
387 /*
388 BACKPATCH: Creating target label for the jump to
389 "case_stmt_action_end_case"
390 (Instruction 12 in the example)
391 */
392
393 1360 pctx->push_label(thd, EMPTY_CSTR, sp->instructions());
394 1360 }
395
396 /**
397 Helper action for a case then statements.
398 This helper is used for both 'simple' and 'searched' cases.
399 @param lex the parser lex context
400 */
401
402 25106 static bool case_stmt_action_then(THD *thd, LEX *lex)
403 {
404 25106 sp_head *sp= lex->sphead;
405 25106 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
406
407 sp_instr_jump *i =
408
1/2
✓ Branch 0 taken 25106 times.
✗ Branch 1 not taken.
25106 new (thd->mem_root) sp_instr_jump(sp->instructions(), pctx);
409
410
3/6
✓ Branch 0 taken 25106 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 25106 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 25106 times.
25106 if (!i || sp->add_instr(thd, i))
411 return true;
412
413 /*
414 BACKPATCH: Resolving forward jump from
415 "case_stmt_action_when" to "case_stmt_action_then"
416 (jump_if_not from instruction 2 to 5, 5 to 8 ... in the example)
417 */
418
419 25106 sp->m_parser_data.do_backpatch(pctx->pop_label(), sp->instructions());
420
421 /*
422 BACKPATCH: Registering forward jump from
423 "case_stmt_action_then" to "case_stmt_action_end_case"
424 (jump from instruction 4 to 12, 7 to 12 ... in the example)
425 */
426
427
1/2
✓ Branch 0 taken 25106 times.
✗ Branch 1 not taken.
25106 return sp->m_parser_data.add_backpatch_entry(i, pctx->last_label());
428 }
429
430 /**
431 Helper action for an end case.
432 This helper is used for both 'simple' and 'searched' cases.
433 @param lex the parser lex context
434 @param simple true for simple cases, false for searched cases
435 */
436
437 1352 static void case_stmt_action_end_case(LEX *lex, bool simple)
438 {
439 1352 sp_head *sp= lex->sphead;
440 1352 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
441
442 /*
443 BACKPATCH: Resolving forward jump from
444 "case_stmt_action_then" to "case_stmt_action_end_case"
445 (jump from instruction 4 to 12, 7 to 12 ... in the example)
446 */
447 1352 sp->m_parser_data.do_backpatch(pctx->pop_label(), sp->instructions());
448
449
2/2
✓ Branch 0 taken 710 times.
✓ Branch 1 taken 642 times.
1352 if (simple)
450 710 pctx->pop_case_expr_id();
451
452 1352 sp->m_parser_data.do_cont_backpatch(sp->instructions());
453 1352 }
454
455
456 9176 static void init_index_hints(List<Index_hint> *hints, index_hint_type type,
457 index_clause_map clause)
458 {
459
1/2
✓ Branch 0 taken 9176 times.
✗ Branch 1 not taken.
9176 List_iterator<Index_hint> it(*hints);
460 Index_hint *hint;
461
2/2
✓ Branch 0 taken 9459 times.
✓ Branch 1 taken 9176 times.
18635 while ((hint= it++))
462 {
463 9459 hint->type= type;
464 9459 hint->clause= clause;
465 }
466 9176 }
467
468 bool my_yyoverflow(short **a, YYSTYPE **b, YYLTYPE **c, ulong *yystacksize);
469
470 #include "sql/parse_tree_column_attrs.h"
471 #include "sql/parse_tree_handler.h"
472 #include "sql/parse_tree_items.h"
473 #include "sql/parse_tree_nodes.h"
474 #include "sql/parse_tree_partitions.h"
475
476 134 void warn_about_deprecated_national(THD *thd)
477 {
478
5/6
✓ Branch 0 taken 134 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 122 times.
✓ Branch 3 taken 12 times.
✓ Branch 4 taken 122 times.
✓ Branch 5 taken 12 times.
268 if (native_strcasecmp(national_charset_info->csname, "utf8") == 0 ||
479 134 native_strcasecmp(national_charset_info->csname, "utf8mb3") == 0)
480 122 push_warning(thd, ER_DEPRECATED_NATIONAL);
481 134 }
482
483 9771 void warn_about_deprecated_binary(THD *thd)
484 {
485 9771 push_deprecated_warn(thd, "BINARY as attribute of a type",
486 "a CHARACTER SET clause with _bin collation");
487 9771 }
488
489 %}
490
491 %start start_entry
492
493 %parse-param { class THD *YYTHD }
494 %parse-param { class Parse_tree_root **parse_tree }
495
496 %lex-param { class THD *YYTHD }
497 %pure-parser /* We have threads */
498 /*
499 1. We do not accept any reduce/reduce conflicts
500 2. We should not introduce new shift/reduce conflicts any more.
501 */
502 %expect 66
503
504
505 /*
506 MAINTAINER:
507
508 1) Comments for TOKENS.
509
510 For each token, please include in the same line a comment that contains
511 one or more of the following tags:
512
513 SQL-2015-N : Non Reserved keyword as per SQL-2015 draft
514 SQL-2015-R : Reserved keyword as per SQL-2015 draft
515 SQL-2003-R : Reserved keyword as per SQL-2003
516 SQL-2003-N : Non Reserved keyword as per SQL-2003
517 SQL-1999-R : Reserved keyword as per SQL-1999
518 SQL-1999-N : Non Reserved keyword as per SQL-1999
519 MYSQL : MySQL extension (unspecified)
520 MYSQL-FUNC : MySQL extension, function
521 INTERNAL : Not a real token, lex optimization
522 OPERATOR : SQL operator
523 FUTURE-USE : Reserved for futur use
524
525 This makes the code grep-able, and helps maintenance.
526
527 2) About token values
528
529 Token values are assigned by bison, in order of declaration.
530
531 Token values are used in query DIGESTS.
532 To make DIGESTS stable, it is desirable to avoid changing token values.
533
534 In practice, this means adding new tokens at the end of the list,
535 in the current release section (8.0),
536 instead of adding them in the middle of the list.
537
538 Failing to comply with instructions below will trigger build failure,
539 as this process is enforced by gen_lex_token.
540
541 3) Instructions to add a new token:
542
543 Add the new token at the end of the list,
544 in the MySQL 8.0 section.
545
546 4) Instructions to remove an old token:
547
548 Do not remove the token, rename it as follows:
549 %token OBSOLETE_TOKEN_<NNN> / * was: TOKEN_FOO * /
550 where NNN is the token value (found in sql_yacc.h)
551
552 For example, see OBSOLETE_TOKEN_820
553 */
554
555 /*
556 Tokens from MySQL 5.7, keep in alphabetical order.
557 */
558
559 %token ABORT_SYM 258 /* INTERNAL (used in lex) */
560 %token ACCESSIBLE_SYM 259
561 %token<lexer.keyword> ACCOUNT_SYM 260
562 %token<lexer.keyword> ACTION 261 /* SQL-2003-N */
563 %token ADD 262 /* SQL-2003-R */
564 %token<lexer.keyword> ADDDATE_SYM 263 /* MYSQL-FUNC */
565 %token<lexer.keyword> AFTER_SYM 264 /* SQL-2003-N */
566 %token<lexer.keyword> AGAINST 265
567 %token<lexer.keyword> AGGREGATE_SYM 266
568 %token<lexer.keyword> ALGORITHM_SYM 267
569 %token ALL 268 /* SQL-2003-R */
570 %token ALTER 269 /* SQL-2003-R */
571 %token<lexer.keyword> ALWAYS_SYM 270
572 %token OBSOLETE_TOKEN_271 271 /* was: ANALYSE_SYM */
573 %token ANALYZE_SYM 272
574 %token AND_AND_SYM 273 /* OPERATOR */
575 %token AND_SYM 274 /* SQL-2003-R */
576 %token<lexer.keyword> ANY_SYM 275 /* SQL-2003-R */
577 %token AS 276 /* SQL-2003-R */
578 %token ASC 277 /* SQL-2003-N */
579 %token<lexer.keyword> ASCII_SYM 278 /* MYSQL-FUNC */
580 %token ASENSITIVE_SYM 279 /* FUTURE-USE */
581 %token<lexer.keyword> AT_SYM 280 /* SQL-2003-R */
582 %token<lexer.keyword> AUTOEXTEND_SIZE_SYM 281
583 %token<lexer.keyword> AUTO_INC 282
584 %token<lexer.keyword> AVG_ROW_LENGTH 283
585 %token<lexer.keyword> AVG_SYM 284 /* SQL-2003-N */
586 %token<lexer.keyword> BACKUP_SYM 285
587 %token BEFORE_SYM 286 /* SQL-2003-N */
588 %token<lexer.keyword> BEGIN_SYM 287 /* SQL-2003-R */
589 %token BETWEEN_SYM 288 /* SQL-2003-R */
590 %token BIGINT_SYM 289 /* SQL-2003-R */
591 %token BINARY_SYM 290 /* SQL-2003-R */
592 %token<lexer.keyword> BINLOG_SYM 291
593 %token BIN_NUM 292
594 %token BIT_AND_SYM 293 /* MYSQL-FUNC */
595 %token BIT_OR_SYM 294 /* MYSQL-FUNC */
596 %token<lexer.keyword> BIT_SYM 295 /* MYSQL-FUNC */
597 %token BIT_XOR_SYM 296 /* MYSQL-FUNC */
598 %token BLOB_SYM 297 /* SQL-2003-R */
599 %token<lexer.keyword> BLOCK_SYM 298
600 %token<lexer.keyword> BOOLEAN_SYM 299 /* SQL-2003-R */
601 %token<lexer.keyword> BOOL_SYM 300
602 %token BOTH 301 /* SQL-2003-R */
603 %token<lexer.keyword> BTREE_SYM 302
604 %token BY 303 /* SQL-2003-R */
605 %token<lexer.keyword> BYTE_SYM 304
606 %token<lexer.keyword> CACHE_SYM 305
607 %token CALL_SYM 306 /* SQL-2003-R */
608 %token CASCADE 307 /* SQL-2003-N */
609 %token<lexer.keyword> CASCADED 308 /* SQL-2003-R */
610 %token CASE_SYM 309 /* SQL-2003-R */
611 %token CAST_SYM 310 /* SQL-2003-R */
612 %token<lexer.keyword> CATALOG_NAME_SYM 311 /* SQL-2003-N */
613 %token<lexer.keyword> CHAIN_SYM 312 /* SQL-2003-N */
614 %token CHANGE 313
615 %token<lexer.keyword> CHANGED 314
616 %token<lexer.keyword> CHANNEL_SYM 315
617 %token<lexer.keyword> CHARSET 316
618 %token CHAR_SYM 317 /* SQL-2003-R */
619 %token<lexer.keyword> CHECKSUM_SYM 318
620 %token CHECK_SYM 319 /* SQL-2003-R */
621 %token<lexer.keyword> CIPHER_SYM 320
622 %token<lexer.keyword> CLASS_ORIGIN_SYM 321 /* SQL-2003-N */
623 %token<lexer.keyword> CLIENT_SYM 322
624 %token<lexer.keyword> CLOSE_SYM 323 /* SQL-2003-R */
625 %token<lexer.keyword> COALESCE 324 /* SQL-2003-N */
626 %token<lexer.keyword> CODE_SYM 325
627 %token COLLATE_SYM 326 /* SQL-2003-R */
628 %token<lexer.keyword> COLLATION_SYM 327 /* SQL-2003-N */
629 %token<lexer.keyword> COLUMNS 328
630 %token COLUMN_SYM 329 /* SQL-2003-R */
631 %token<lexer.keyword> COLUMN_FORMAT_SYM 330
632 %token<lexer.keyword> COLUMN_NAME_SYM 331 /* SQL-2003-N */
633 %token<lexer.keyword> COMMENT_SYM 332
634 %token<lexer.keyword> COMMITTED_SYM 333 /* SQL-2003-N */
635 %token<lexer.keyword> COMMIT_SYM 334 /* SQL-2003-R */
636 %token<lexer.keyword> COMPACT_SYM 335
637 %token<lexer.keyword> COMPLETION_SYM 336
638 %token<lexer.keyword> COMPRESSED_SYM 337
639 %token<lexer.keyword> COMPRESSION_SYM 338
640 %token<lexer.keyword> ENCRYPTION_SYM 339
641 %token<lexer.keyword> CONCURRENT 340
642 %token CONDITION_SYM 341 /* SQL-2003-R, SQL-2008-R */
643 %token<lexer.keyword> CONNECTION_SYM 342
644 %token<lexer.keyword> CONSISTENT_SYM 343
645 %token CONSTRAINT 344 /* SQL-2003-R */
646 %token<lexer.keyword> CONSTRAINT_CATALOG_SYM 345 /* SQL-2003-N */
647 %token<lexer.keyword> CONSTRAINT_NAME_SYM 346 /* SQL-2003-N */
648 %token<lexer.keyword> CONSTRAINT_SCHEMA_SYM 347 /* SQL-2003-N */
649 %token<lexer.keyword> CONTAINS_SYM 348 /* SQL-2003-N */
650 %token<lexer.keyword> CONTEXT_SYM 349
651 %token CONTINUE_SYM 350 /* SQL-2003-R */
652 %token CONVERT_SYM 351 /* SQL-2003-N */
653 %token COUNT_SYM 352 /* SQL-2003-N */
654 %token<lexer.keyword> CPU_SYM 353
655 %token CREATE 354 /* SQL-2003-R */
656 %token CROSS 355 /* SQL-2003-R */
657 %token CUBE_SYM 356 /* SQL-2003-R */
658 %token CURDATE 357 /* MYSQL-FUNC */
659 %token<lexer.keyword> CURRENT_SYM 358 /* SQL-2003-R */
660 %token CURRENT_USER 359 /* SQL-2003-R */
661 %token CURSOR_SYM 360 /* SQL-2003-R */
662 %token<lexer.keyword> CURSOR_NAME_SYM 361 /* SQL-2003-N */
663 %token CURTIME 362 /* MYSQL-FUNC */
664 %token DATABASE 363
665 %token DATABASES 364
666 %token<lexer.keyword> DATAFILE_SYM 365
667 %token<lexer.keyword> DATA_SYM 366 /* SQL-2003-N */
668 %token<lexer.keyword> DATETIME_SYM 367 /* MYSQL */
669 %token DATE_ADD_INTERVAL 368 /* MYSQL-FUNC */
670 %token DATE_SUB_INTERVAL 369 /* MYSQL-FUNC */
671 %token<lexer.keyword> DATE_SYM 370 /* SQL-2003-R */
672 %token DAY_HOUR_SYM 371
673 %token DAY_MICROSECOND_SYM 372
674 %token DAY_MINUTE_SYM 373
675 %token DAY_SECOND_SYM 374
676 %token<lexer.keyword> DAY_SYM 375 /* SQL-2003-R */
677 %token<lexer.keyword> DEALLOCATE_SYM 376 /* SQL-2003-R */
678 %token DECIMAL_NUM 377
679 %token DECIMAL_SYM 378 /* SQL-2003-R */
680 %token DECLARE_SYM 379 /* SQL-2003-R */
681 %token DEFAULT_SYM 380 /* SQL-2003-R */
682 %token<lexer.keyword> DEFAULT_AUTH_SYM 381 /* INTERNAL */
683 %token<lexer.keyword> DEFINER_SYM 382
684 %token DELAYED_SYM 383
685 %token<lexer.keyword> DELAY_KEY_WRITE_SYM 384
686 %token DELETE_SYM 385 /* SQL-2003-R */
687 %token DESC 386 /* SQL-2003-N */
688 %token DESCRIBE 387 /* SQL-2003-R */
689 %token OBSOLETE_TOKEN_388 388 /* was: DES_KEY_FILE */
690 %token DETERMINISTIC_SYM 389 /* SQL-2003-R */
691 %token<lexer.keyword> DIAGNOSTICS_SYM 390 /* SQL-2003-N */
692 %token<lexer.keyword> DIRECTORY_SYM 391
693 %token<lexer.keyword> DISABLE_SYM 392
694 %token<lexer.keyword> DISCARD_SYM 393 /* MYSQL */
695 %token<lexer.keyword> DISK_SYM 394
696 %token DISTINCT 395 /* SQL-2003-R */
697 %token DIV_SYM 396
698 %token DOUBLE_SYM 397 /* SQL-2003-R */
699 %token<lexer.keyword> DO_SYM 398
700 %token DROP 399 /* SQL-2003-R */
701 %token DUAL_SYM 400
702 %token<lexer.keyword> DUMPFILE 401
703 %token<lexer.keyword> DUPLICATE_SYM 402
704 %token<lexer.keyword> DYNAMIC_SYM 403 /* SQL-2003-R */
705 %token EACH_SYM 404 /* SQL-2003-R */
706 %token ELSE 405 /* SQL-2003-R */
707 %token ELSEIF_SYM 406
708 %token<lexer.keyword> ENABLE_SYM 407
709 %token ENCLOSED 408
710 %token<lexer.keyword> END 409 /* SQL-2003-R */
711 %token<lexer.keyword> ENDS_SYM 410
712 %token END_OF_INPUT 411 /* INTERNAL */
713 %token<lexer.keyword> ENGINES_SYM 412
714 %token<lexer.keyword> ENGINE_SYM 413
715 %token<lexer.keyword> ENUM_SYM 414 /* MYSQL */
716 %token EQ 415 /* OPERATOR */
717 %token EQUAL_SYM 416 /* OPERATOR */
718 %token<lexer.keyword> ERROR_SYM 417
719 %token<lexer.keyword> ERRORS 418
720 %token ESCAPED 419
721 %token<lexer.keyword> ESCAPE_SYM 420 /* SQL-2003-R */
722 %token<lexer.keyword> EVENTS_SYM 421
723 %token<lexer.keyword> EVENT_SYM 422
724 %token<lexer.keyword> EVERY_SYM 423 /* SQL-2003-N */
725 %token<lexer.keyword> EXCHANGE_SYM 424
726 %token<lexer.keyword> EXECUTE_SYM 425 /* SQL-2003-R */
727 %token EXISTS 426 /* SQL-2003-R */
728 %token EXIT_SYM 427
729 %token<lexer.keyword> EXPANSION_SYM 428
730 %token<lexer.keyword> EXPIRE_SYM 429
731 %token<lexer.keyword> EXPORT_SYM 430
732 %token<lexer.keyword> EXTENDED_SYM 431
733 %token<lexer.keyword> EXTENT_SIZE_SYM 432
734 %token EXTRACT_SYM 433 /* SQL-2003-N */
735 %token FALSE_SYM 434 /* SQL-2003-R */
736 %token<lexer.keyword> FAST_SYM 435
737 %token<lexer.keyword> FAULTS_SYM 436
738 %token FETCH_SYM 437 /* SQL-2003-R */
739 %token<lexer.keyword> FILE_SYM 438
740 %token<lexer.keyword> FILE_BLOCK_SIZE_SYM 439
741 %token<lexer.keyword> FILTER_SYM 440
742 %token<lexer.keyword> FIRST_SYM 441 /* SQL-2003-N */
743 %token<lexer.keyword> FIXED_SYM 442
744 %token FLOAT_NUM 443
745 %token FLOAT_SYM 444 /* SQL-2003-R */
746 %token<lexer.keyword> FLUSH_SYM 445
747 %token<lexer.keyword> FOLLOWS_SYM 446 /* MYSQL */
748 %token FORCE_SYM 447
749 %token FOREIGN 448 /* SQL-2003-R */
750 %token FOR_SYM 449 /* SQL-2003-R */
751 %token<lexer.keyword> FORMAT_SYM 450
752 %token<lexer.keyword> FOUND_SYM 451 /* SQL-2003-R */
753 %token FROM 452
754 %token<lexer.keyword> FULL 453 /* SQL-2003-R */
755 %token FULLTEXT_SYM 454
756 %token FUNCTION_SYM 455 /* SQL-2003-R */
757 %token GE 456
758 %token<lexer.keyword> GENERAL 457
759 %token GENERATED 458
760 %token<lexer.keyword> GROUP_REPLICATION 459
761 %token<lexer.keyword> GEOMETRYCOLLECTION_SYM 460 /* MYSQL */
762 %token<lexer.keyword> GEOMETRY_SYM 461
763 %token<lexer.keyword> GET_FORMAT 462 /* MYSQL-FUNC */
764 %token GET_SYM 463 /* SQL-2003-R */
765 %token<lexer.keyword> GLOBAL_SYM 464 /* SQL-2003-R */
766 %token GRANT 465 /* SQL-2003-R */
767 %token<lexer.keyword> GRANTS 466
768 %token GROUP_SYM 467 /* SQL-2003-R */
769 %token GROUP_CONCAT_SYM 468
770 %token GT_SYM 469 /* OPERATOR */
771 %token<lexer.keyword> HANDLER_SYM 470
772 %token<lexer.keyword> HASH_SYM 471
773 %token HAVING 472 /* SQL-2003-R */
774 %token<lexer.keyword> HELP_SYM 473
775 %token HEX_NUM 474
776 %token HIGH_PRIORITY 475
777 %token<lexer.keyword> HOST_SYM 476
778 %token<lexer.keyword> HOSTS_SYM 477
779 %token HOUR_MICROSECOND_SYM 478
780 %token HOUR_MINUTE_SYM 479
781 %token HOUR_SECOND_SYM 480
782 %token<lexer.keyword> HOUR_SYM 481 /* SQL-2003-R */
783 %token IDENT 482
784 %token<lexer.keyword> IDENTIFIED_SYM 483
785 %token IDENT_QUOTED 484
786 %token IF 485
787 %token IGNORE_SYM 486
788 %token<lexer.keyword> IGNORE_SERVER_IDS_SYM 487
789 %token<lexer.keyword> IMPORT 488
790 %token<lexer.keyword> INDEXES 489
791 %token INDEX_SYM 490
792 %token INFILE 491
793 %token<lexer.keyword> INITIAL_SIZE_SYM 492
794 %token INNER_SYM 493 /* SQL-2003-R */
795 %token INOUT_SYM 494 /* SQL-2003-R */
796 %token INSENSITIVE_SYM 495 /* SQL-2003-R */
797 %token INSERT_SYM 496 /* SQL-2003-R */
798 %token<lexer.keyword> INSERT_METHOD 497
799 %token<lexer.keyword> INSTANCE_SYM 498
800 %token<lexer.keyword> INSTALL_SYM 499
801 %token INTERVAL_SYM 500 /* SQL-2003-R */
802 %token INTO 501 /* SQL-2003-R */
803 %token INT_SYM 502 /* SQL-2003-R */
804 %token<lexer.keyword> INVOKER_SYM 503
805 %token IN_SYM 504 /* SQL-2003-R */
806 %token IO_AFTER_GTIDS 505 /* MYSQL, FUTURE-USE */
807 %token IO_BEFORE_GTIDS 506 /* MYSQL, FUTURE-USE */
808 %token<lexer.keyword> IO_SYM 507
809 %token<lexer.keyword> IPC_SYM 508
810 %token IS 509 /* SQL-2003-R */
811 %token<lexer.keyword> ISOLATION 510 /* SQL-2003-R */
812 %token<lexer.keyword> ISSUER_SYM 511
813 %token ITERATE_SYM 512
814 %token JOIN_SYM 513 /* SQL-2003-R */
815 %token JSON_SEPARATOR_SYM 514 /* MYSQL */
816 %token<lexer.keyword> JSON_SYM 515 /* MYSQL */
817 %token KEYS 516
818 %token<lexer.keyword> KEY_BLOCK_SIZE 517
819 %token KEY_SYM 518 /* SQL-2003-N */
820 %token KILL_SYM 519
821 %token<lexer.keyword> LANGUAGE_SYM 520 /* SQL-2003-R */
822 %token<lexer.keyword> LAST_SYM 521 /* SQL-2003-N */
823 %token LE 522 /* OPERATOR */
824 %token LEADING 523 /* SQL-2003-R */
825 %token<lexer.keyword> LEAVES 524
826 %token LEAVE_SYM 525
827 %token LEFT 526 /* SQL-2003-R */
828 %token<lexer.keyword> LESS_SYM 527
829 %token<lexer.keyword> LEVEL_SYM 528
830 %token LEX_HOSTNAME 529
831 %token LIKE 530 /* SQL-2003-R */
832 %token LIMIT 531
833 %token LINEAR_SYM 532
834 %token LINES 533
835 %token<lexer.keyword> LINESTRING_SYM 534 /* MYSQL */
836 %token<lexer.keyword> LIST_SYM 535
837 %token LOAD 536
838 %token<lexer.keyword> LOCAL_SYM 537 /* SQL-2003-R */
839 %token OBSOLETE_TOKEN_538 538 /* was: LOCATOR_SYM */
840 %token<lexer.keyword> LOCKS_SYM 539
841 %token LOCK_SYM 540
842 %token<lexer.keyword> LOGFILE_SYM 541
843 %token<lexer.keyword> LOGS_SYM 542
844 %token LONGBLOB_SYM 543 /* MYSQL */
845 %token LONGTEXT_SYM 544 /* MYSQL */
846 %token LONG_NUM 545
847 %token LONG_SYM 546
848 %token LOOP_SYM 547
849 %token LOW_PRIORITY 548
850 %token LT 549 /* OPERATOR */
851 %token<lexer.keyword> MASTER_AUTO_POSITION_SYM 550
852 %token MASTER_BIND_SYM 551
853 %token<lexer.keyword> MASTER_CONNECT_RETRY_SYM 552
854 %token<lexer.keyword> MASTER_DELAY_SYM 553
855 %token<lexer.keyword> MASTER_HOST_SYM 554
856 %token<lexer.keyword> MASTER_LOG_FILE_SYM 555
857 %token<lexer.keyword> MASTER_LOG_POS_SYM 556
858 %token<lexer.keyword> MASTER_PASSWORD_SYM 557
859 %token<lexer.keyword> MASTER_PORT_SYM 558
860 %token<lexer.keyword> MASTER_RETRY_COUNT_SYM 559
861 /* %token<lexer.keyword> MASTER_SERVER_ID_SYM 560 */ /* UNUSED */
862 %token<lexer.keyword> MASTER_SSL_CAPATH_SYM 561
863 %token<lexer.keyword> MASTER_TLS_VERSION_SYM 562
864 %token<lexer.keyword> MASTER_SSL_CA_SYM 563
865 %token<lexer.keyword> MASTER_SSL_CERT_SYM 564
866 %token<lexer.keyword> MASTER_SSL_CIPHER_SYM 565
867 %token<lexer.keyword> MASTER_SSL_CRL_SYM 566
868 %token<lexer.keyword> MASTER_SSL_CRLPATH_SYM 567
869 %token<lexer.keyword> MASTER_SSL_KEY_SYM 568
870 %token<lexer.keyword> MASTER_SSL_SYM 569
871 %token MASTER_SSL_VERIFY_SERVER_CERT_SYM 570
872 %token<lexer.keyword> MASTER_SYM 571
873 %token<lexer.keyword> MASTER_USER_SYM 572
874 %token<lexer.keyword> MASTER_HEARTBEAT_PERIOD_SYM 573
875 %token MATCH 574 /* SQL-2003-R */
876 %token<lexer.keyword> MAX_CONNECTIONS_PER_HOUR 575
877 %token<lexer.keyword> MAX_QUERIES_PER_HOUR 576
878 %token<lexer.keyword> MAX_ROWS 577
879 %token<lexer.keyword> MAX_SIZE_SYM 578
880 %token MAX_SYM 579 /* SQL-2003-N */
881 %token<lexer.keyword> MAX_UPDATES_PER_HOUR 580
882 %token<lexer.keyword> MAX_USER_CONNECTIONS_SYM 581
883 %token MAX_VALUE_SYM 582 /* SQL-2003-N */
884 %token MEDIUMBLOB_SYM 583 /* MYSQL */
885 %token MEDIUMINT_SYM 584 /* MYSQL */
886 %token MEDIUMTEXT_SYM 585 /* MYSQL */
887 %token<lexer.keyword> MEDIUM_SYM 586
888 %token<lexer.keyword> MEMORY_SYM 587
889 %token<lexer.keyword> MERGE_SYM 588 /* SQL-2003-R */
890 %token<lexer.keyword> MESSAGE_TEXT_SYM 589 /* SQL-2003-N */
891 %token<lexer.keyword> MICROSECOND_SYM 590 /* MYSQL-FUNC */
892 %token<lexer.keyword> MIGRATE_SYM 591
893 %token MINUTE_MICROSECOND_SYM 592
894 %token MINUTE_SECOND_SYM 593
895 %token<lexer.keyword> MINUTE_SYM 594 /* SQL-2003-R */
896 %token<lexer.keyword> MIN_ROWS 595
897 %token MIN_SYM 596 /* SQL-2003-N */
898 %token<lexer.keyword> MODE_SYM 597
899 %token MODIFIES_SYM 598 /* SQL-2003-R */
900 %token<lexer.keyword> MODIFY_SYM 599
901 %token MOD_SYM 600 /* SQL-2003-N */
902 %token<lexer.keyword> MONTH_SYM 601 /* SQL-2003-R */
903 %token<lexer.keyword> MULTILINESTRING_SYM 602 /* MYSQL */
904 %token<lexer.keyword> MULTIPOINT_SYM 603 /* MYSQL */
905 %token<lexer.keyword> MULTIPOLYGON_SYM 604 /* MYSQL */
906 %token<lexer.keyword> MUTEX_SYM 605
907 %token<lexer.keyword> MYSQL_ERRNO_SYM 606
908 %token<lexer.keyword> NAMES_SYM 607 /* SQL-2003-N */
909 %token<lexer.keyword> NAME_SYM 608 /* SQL-2003-N */
910 %token<lexer.keyword> NATIONAL_SYM 609 /* SQL-2003-R */
911 %token NATURAL 610 /* SQL-2003-R */
912 %token NCHAR_STRING 611
913 %token<lexer.keyword> NCHAR_SYM 612 /* SQL-2003-R */
914 %token<lexer.keyword> NDBCLUSTER_SYM 613
915 %token NE 614 /* OPERATOR */
916 %token NEG 615
917 %token<lexer.keyword> NEVER_SYM 616
918 %token<lexer.keyword> NEW_SYM 617 /* SQL-2003-R */
919 %token<lexer.keyword> NEXT_SYM 618 /* SQL-2003-N */
920 %token<lexer.keyword> NODEGROUP_SYM 619
921 %token<lexer.keyword> NONE_SYM 620 /* SQL-2003-R */
922 %token NOT2_SYM 621
923 %token NOT_SYM 622 /* SQL-2003-R */
924 %token NOW_SYM 623
925 %token<lexer.keyword> NO_SYM 624 /* SQL-2003-R */
926 %token<lexer.keyword> NO_WAIT_SYM 625
927 %token NO_WRITE_TO_BINLOG 626
928 %token NULL_SYM 627 /* SQL-2003-R */
929 %token NUM 628
930 %token<lexer.keyword> NUMBER_SYM 629 /* SQL-2003-N */
931 %token NUMERIC_SYM 630 /* SQL-2003-R */
932 %token<lexer.keyword> NVARCHAR_SYM 631
933 %token<lexer.keyword> OFFSET_SYM 632
934 %token ON_SYM 633 /* SQL-2003-R */
935 %token<lexer.keyword> ONE_SYM 634
936 %token<lexer.keyword> ONLY_SYM 635 /* SQL-2003-R */
937 %token<lexer.keyword> OPEN_SYM 636 /* SQL-2003-R */
938 %token OPTIMIZE 637
939 %token OPTIMIZER_COSTS_SYM 638
940 %token<lexer.keyword> OPTIONS_SYM 639
941 %token OPTION 640 /* SQL-2003-N */
942 %token OPTIONALLY 641
943 %token OR2_SYM 642
944 %token ORDER_SYM 643 /* SQL-2003-R */
945 %token OR_OR_SYM 644 /* OPERATOR */
946 %token OR_SYM 645 /* SQL-2003-R */
947 %token OUTER_SYM 646
948 %token OUTFILE 647
949 %token OUT_SYM 648 /* SQL-2003-R */
950 %token<lexer.keyword> OWNER_SYM 649
951 %token<lexer.keyword> PACK_KEYS_SYM 650
952 %token<lexer.keyword> PAGE_SYM 651
953 %token PARAM_MARKER 652
954 %token<lexer.keyword> PARSER_SYM 653
955 %token OBSOLETE_TOKEN_654 654 /* was: PARSE_GCOL_EXPR_SYM */
956 %token<lexer.keyword> PARTIAL 655 /* SQL-2003-N */
957 %token PARTITION_SYM 656 /* SQL-2003-R */
958 %token<lexer.keyword> PARTITIONS_SYM 657
959 %token<lexer.keyword> PARTITIONING_SYM 658
960 %token<lexer.keyword> PASSWORD 659
961 %token<lexer.keyword> PHASE_SYM 660
962 %token<lexer.keyword> PLUGIN_DIR_SYM 661 /* INTERNAL */
963 %token<lexer.keyword> PLUGIN_SYM 662
964 %token<lexer.keyword> PLUGINS_SYM 663
965 %token<lexer.keyword> POINT_SYM 664
966 %token<lexer.keyword> POLYGON_SYM 665 /* MYSQL */
967 %token<lexer.keyword> PORT_SYM 666
968 %token POSITION_SYM 667 /* SQL-2003-N */
969 %token<lexer.keyword> PRECEDES_SYM 668 /* MYSQL */
970 %token PRECISION 669 /* SQL-2003-R */
971 %token<lexer.keyword> PREPARE_SYM 670 /* SQL-2003-R */
972 %token<lexer.keyword> PRESERVE_SYM 671
973 %token<lexer.keyword> PREV_SYM 672
974 %token PRIMARY_SYM 673 /* SQL-2003-R */
975 %token<lexer.keyword> PRIVILEGES 674 /* SQL-2003-N */
976 %token PROCEDURE_SYM 675 /* SQL-2003-R */
977 %token<lexer.keyword> PROCESS 676
978 %token<lexer.keyword> PROCESSLIST_SYM 677
979 %token<lexer.keyword> PROFILE_SYM 678
980 %token<lexer.keyword> PROFILES_SYM 679
981 %token<lexer.keyword> PROXY_SYM 680
982 %token PURGE 681
983 %token<lexer.keyword> QUARTER_SYM 682
984 %token<lexer.keyword> QUERY_SYM 683
985 %token<lexer.keyword> QUICK 684
986 %token RANGE_SYM 685 /* SQL-2003-R */
987 %token READS_SYM 686 /* SQL-2003-R */
988 %token<lexer.keyword> READ_ONLY_SYM 687
989 %token READ_SYM 688 /* SQL-2003-N */
990 %token READ_WRITE_SYM 689
991 %token REAL_SYM 690 /* SQL-2003-R */
992 %token<lexer.keyword> REBUILD_SYM 691
993 %token<lexer.keyword> RECOVER_SYM 692
994 %token OBSOLETE_TOKEN_693 693 /* was: REDOFILE_SYM */
995 %token<lexer.keyword> REDO_BUFFER_SIZE_SYM 694
996 %token<lexer.keyword> REDUNDANT_SYM 695
997 %token REFERENCES 696 /* SQL-2003-R */
998 %token REGEXP 697
999 %token<lexer.keyword> RELAY 698
1000 %token<lexer.keyword> RELAYLOG_SYM 699
1001 %token<lexer.keyword> RELAY_LOG_FILE_SYM 700
1002 %token<lexer.keyword> RELAY_LOG_POS_SYM 701
1003 %token<lexer.keyword> RELAY_THREAD 702
1004 %token RELEASE_SYM 703 /* SQL-2003-R */
1005 %token<lexer.keyword> RELOAD 704
1006 %token<lexer.keyword> REMOVE_SYM 705
1007 %token RENAME 706
1008 %token<lexer.keyword> REORGANIZE_SYM 707
1009 %token<lexer.keyword> REPAIR 708
1010 %token<lexer.keyword> REPEATABLE_SYM 709 /* SQL-2003-N */
1011 %token REPEAT_SYM 710 /* MYSQL-FUNC */
1012 %token REPLACE_SYM 711 /* MYSQL-FUNC */
1013 %token<lexer.keyword> REPLICATION 712
1014 %token<lexer.keyword> REPLICATE_DO_DB 713
1015 %token<lexer.keyword> REPLICATE_IGNORE_DB 714
1016 %token<lexer.keyword> REPLICATE_DO_TABLE 715
1017 %token<lexer.keyword> REPLICATE_IGNORE_TABLE 716
1018 %token<lexer.keyword> REPLICATE_WILD_DO_TABLE 717
1019 %token<lexer.keyword> REPLICATE_WILD_IGNORE_TABLE 718
1020 %token<lexer.keyword> REPLICATE_REWRITE_DB 719
1021 %token REQUIRE_SYM 720
1022 %token<lexer.keyword> RESET_SYM 721
1023 %token RESIGNAL_SYM 722 /* SQL-2003-R */
1024 %token<lexer.keyword> RESOURCES 723
1025 %token<lexer.keyword> RESTORE_SYM 724
1026 %token RESTRICT 725
1027 %token<lexer.keyword> RESUME_SYM 726
1028 %token<lexer.keyword> RETURNED_SQLSTATE_SYM 727 /* SQL-2003-N */
1029 %token<lexer.keyword> RETURNS_SYM 728 /* SQL-2003-R */
1030 %token RETURN_SYM 729 /* SQL-2003-R */
1031 %token<lexer.keyword> REVERSE_SYM 730
1032 %token REVOKE 731 /* SQL-2003-R */
1033 %token RIGHT 732 /* SQL-2003-R */
1034 %token<lexer.keyword> ROLLBACK_SYM 733 /* SQL-2003-R */
1035 %token<lexer.keyword> ROLLUP_SYM 734 /* SQL-2003-R */
1036 %token<lexer.keyword> ROTATE_SYM 735
1037 %token<lexer.keyword> ROUTINE_SYM 736 /* SQL-2003-N */
1038 %token ROWS_SYM 737 /* SQL-2003-R */
1039 %token<lexer.keyword> ROW_FORMAT_SYM 738
1040 %token ROW_SYM 739 /* SQL-2003-R */
1041 %token<lexer.keyword> ROW_COUNT_SYM 740 /* SQL-2003-N */
1042 %token<lexer.keyword> RTREE_SYM 741
1043 %token<lexer.keyword> SAVEPOINT_SYM 742 /* SQL-2003-R */
1044 %token<lexer.keyword> SCHEDULE_SYM 743
1045 %token<lexer.keyword> SCHEMA_NAME_SYM 744 /* SQL-2003-N */
1046 %token SECOND_MICROSECOND_SYM 745
1047 %token<lexer.keyword> SECOND_SYM 746 /* SQL-2003-R */
1048 %token<lexer.keyword> SECURITY_SYM 747 /* SQL-2003-N */
1049 %token SELECT_SYM 748 /* SQL-2003-R */
1050 %token SENSITIVE_SYM 749 /* FUTURE-USE */
1051 %token SEPARATOR_SYM 750
1052 %token<lexer.keyword> SERIALIZABLE_SYM 751 /* SQL-2003-N */
1053 %token<lexer.keyword> SERIAL_SYM 752
1054 %token<lexer.keyword> SESSION_SYM 753 /* SQL-2003-N */
1055 %token<lexer.keyword> SERVER_SYM 754
1056 %token OBSOLETE_TOKEN_755 755 /* was: SERVER_OPTIONS */
1057 %token SET_SYM 756 /* SQL-2003-R */
1058 %token SET_VAR 757
1059 %token<lexer.keyword> SHARE_SYM 758
1060 %token SHIFT_LEFT 759 /* OPERATOR */
1061 %token SHIFT_RIGHT 760 /* OPERATOR */
1062 %token SHOW 761
1063 %token<lexer.keyword> SHUTDOWN 762
1064 %token SIGNAL_SYM 763 /* SQL-2003-R */
1065 %token<lexer.keyword> SIGNED_SYM 764
1066 %token<lexer.keyword> SIMPLE_SYM 765 /* SQL-2003-N */
1067 %token<lexer.keyword> SLAVE 766
1068 %token<lexer.keyword> SLOW 767
1069 %token SMALLINT_SYM 768 /* SQL-2003-R */
1070 %token<lexer.keyword> SNAPSHOT_SYM 769
1071 %token<lexer.keyword> SOCKET_SYM 770
1072 %token<lexer.keyword> SONAME_SYM 771
1073 %token<lexer.keyword> SOUNDS_SYM 772
1074 %token<lexer.keyword> SOURCE_SYM 773
1075 %token SPATIAL_SYM 774
1076 %token SPECIFIC_SYM 775 /* SQL-2003-R */
1077 %token SQLEXCEPTION_SYM 776 /* SQL-2003-R */
1078 %token SQLSTATE_SYM 777 /* SQL-2003-R */
1079 %token SQLWARNING_SYM 778 /* SQL-2003-R */
1080 %token<lexer.keyword> SQL_AFTER_GTIDS 779 /* MYSQL */
1081 %token<lexer.keyword> SQL_AFTER_MTS_GAPS 780 /* MYSQL */
1082 %token<lexer.keyword> SQL_BEFORE_GTIDS 781 /* MYSQL */
1083 %token SQL_BIG_RESULT 782
1084 %token<lexer.keyword> SQL_BUFFER_RESULT 783
1085 %token OBSOLETE_TOKEN_784 784 /* was: SQL_CACHE_SYM */
1086 %token SQL_CALC_FOUND_ROWS 785
1087 %token<lexer.keyword> SQL_NO_CACHE_SYM 786
1088 %token SQL_SMALL_RESULT 787
1089 %token SQL_SYM 788 /* SQL-2003-R */
1090 %token<lexer.keyword> SQL_THREAD 789
1091 %token SSL_SYM 790
1092 %token<lexer.keyword> STACKED_SYM 791 /* SQL-2003-N */
1093 %token STARTING 792
1094 %token<lexer.keyword> STARTS_SYM 793
1095 %token<lexer.keyword> START_SYM 794 /* SQL-2003-R */
1096 %token<lexer.keyword> STATS_AUTO_RECALC_SYM 795
1097 %token<lexer.keyword> STATS_PERSISTENT_SYM 796
1098 %token<lexer.keyword> STATS_SAMPLE_PAGES_SYM 797
1099 %token<lexer.keyword> STATUS_SYM 798
1100 %token STDDEV_SAMP_SYM 799 /* SQL-2003-N */
1101 %token STD_SYM 800
1102 %token<lexer.keyword> STOP_SYM 801
1103 %token<lexer.keyword> STORAGE_SYM 802
1104 %token STORED_SYM 803
1105 %token STRAIGHT_JOIN 804
1106 %token<lexer.keyword> STRING_SYM 805
1107 %token<lexer.keyword> SUBCLASS_ORIGIN_SYM 806 /* SQL-2003-N */
1108 %token<lexer.keyword> SUBDATE_SYM 807
1109 %token<lexer.keyword> SUBJECT_SYM 808
1110 %token<lexer.keyword> SUBPARTITIONS_SYM 809
1111 %token<lexer.keyword> SUBPARTITION_SYM 810
1112 %token SUBSTRING 811 /* SQL-2003-N */
1113 %token SUM_SYM 812 /* SQL-2003-N */
1114 %token<lexer.keyword> SUPER_SYM 813
1115 %token<lexer.keyword> SUSPEND_SYM 814
1116 %token<lexer.keyword> SWAPS_SYM 815
1117 %token<lexer.keyword> SWITCHES_SYM 816
1118 %token SYSDATE 817
1119 %token<lexer.keyword> TABLES 818
1120 %token<lexer.keyword> TABLESPACE_SYM 819
1121 %token OBSOLETE_TOKEN_820 820 /* was: TABLE_REF_PRIORITY */
1122 %token TABLE_SYM 821 /* SQL-2003-R */
1123 %token<lexer.keyword> TABLE_CHECKSUM_SYM 822
1124 %token<lexer.keyword> TABLE_NAME_SYM 823 /* SQL-2003-N */
1125 %token<lexer.keyword> TEMPORARY 824 /* SQL-2003-N */
1126 %token<lexer.keyword> TEMPTABLE_SYM 825
1127 %token TERMINATED 826
1128 %token TEXT_STRING 827
1129 %token<lexer.keyword> TEXT_SYM 828
1130 %token<lexer.keyword> THAN_SYM 829
1131 %token THEN_SYM 830 /* SQL-2003-R */
1132 %token<lexer.keyword> TIMESTAMP_SYM 831 /* SQL-2003-R */
1133 %token<lexer.keyword> TIMESTAMP_ADD 832
1134 %token<lexer.keyword> TIMESTAMP_DIFF 833
1135 %token<lexer.keyword> TIME_SYM 834 /* SQL-2003-R */
1136 %token TINYBLOB_SYM 835 /* MYSQL */
1137 %token TINYINT_SYM 836 /* MYSQL */
1138 %token TINYTEXT_SYN 837 /* MYSQL */
1139 %token TO_SYM 838 /* SQL-2003-R */
1140 %token TRAILING 839 /* SQL-2003-R */
1141 %token<lexer.keyword> TRANSACTION_SYM 840
1142 %token<lexer.keyword> TRIGGERS_SYM 841
1143 %token TRIGGER_SYM 842 /* SQL-2003-R */
1144 %token TRIM 843 /* SQL-2003-N */
1145 %token TRUE_SYM 844 /* SQL-2003-R */
1146 %token<lexer.keyword> TRUNCATE_SYM 845
1147 %token<lexer.keyword> TYPES_SYM 846
1148 %token<lexer.keyword> TYPE_SYM 847 /* SQL-2003-N */
1149 %token OBSOLETE_TOKEN_848 848 /* was: UDF_RETURNS_SYM */
1150 %token ULONGLONG_NUM 849
1151 %token<lexer.keyword> UNCOMMITTED_SYM 850 /* SQL-2003-N */
1152 %token<lexer.keyword> UNDEFINED_SYM 851
1153 %token UNDERSCORE_CHARSET 852
1154 %token<lexer.keyword> UNDOFILE_SYM 853
1155 %token<lexer.keyword> UNDO_BUFFER_SIZE_SYM 854
1156 %token UNDO_SYM 855 /* FUTURE-USE */
1157 %token<lexer.keyword> UNICODE_SYM 856
1158 %token<lexer.keyword> UNINSTALL_SYM 857
1159 %token UNION_SYM 858 /* SQL-2003-R */
1160 %token UNIQUE_SYM 859
1161 %token<lexer.keyword> UNKNOWN_SYM 860 /* SQL-2003-R */
1162 %token UNLOCK_SYM 861
1163 %token UNSIGNED_SYM 862 /* MYSQL */
1164 %token<lexer.keyword> UNTIL_SYM 863
1165 %token UPDATE_SYM 864 /* SQL-2003-R */
1166 %token<lexer.keyword> UPGRADE_SYM 865
1167 %token USAGE 866 /* SQL-2003-N */
1168 %token<lexer.keyword> USER 867 /* SQL-2003-R */
1169 %token<lexer.keyword> USE_FRM 868
1170 %token USE_SYM 869
1171 %token USING 870 /* SQL-2003-R */
1172 %token UTC_DATE_SYM 871
1173 %token UTC_TIMESTAMP_SYM 872
1174 %token UTC_TIME_SYM 873
1175 %token<lexer.keyword> VALIDATION_SYM 874 /* MYSQL */
1176 %token VALUES 875 /* SQL-2003-R */
1177 %token<lexer.keyword> VALUE_SYM 876 /* SQL-2003-R */
1178 %token VARBINARY_SYM 877 /* SQL-2008-R */
1179 %token VARCHAR_SYM 878 /* SQL-2003-R */
1180 %token<lexer.keyword> VARIABLES 879
1181 %token VARIANCE_SYM 880
1182 %token VARYING 881 /* SQL-2003-R */
1183 %token VAR_SAMP_SYM 882
1184 %token<lexer.keyword> VIEW_SYM 883 /* SQL-2003-N */
1185 %token VIRTUAL_SYM 884
1186 %token<lexer.keyword> WAIT_SYM 885
1187 %token<lexer.keyword> WARNINGS 886
1188 %token<lexer.keyword> WEEK_SYM 887
1189 %token<lexer.keyword> WEIGHT_STRING_SYM 888
1190 %token WHEN_SYM 889 /* SQL-2003-R */
1191 %token WHERE 890 /* SQL-2003-R */
1192 %token WHILE_SYM 891
1193 %token WITH 892 /* SQL-2003-R */
1194 %token OBSOLETE_TOKEN_893 893 /* was: WITH_CUBE_SYM */
1195 %token WITH_ROLLUP_SYM 894 /* INTERNAL */
1196 %token<lexer.keyword> WITHOUT_SYM 895 /* SQL-2003-R */
1197 %token<lexer.keyword> WORK_SYM 896 /* SQL-2003-N */
1198 %token<lexer.keyword> WRAPPER_SYM 897
1199 %token WRITE_SYM 898 /* SQL-2003-N */
1200 %token<lexer.keyword> X509_SYM 899
1201 %token<lexer.keyword> XA_SYM 900
1202 %token<lexer.keyword> XID_SYM 901 /* MYSQL */
1203 %token<lexer.keyword> XML_SYM 902
1204 %token XOR 903
1205 %token YEAR_MONTH_SYM 904
1206 %token<lexer.keyword> YEAR_SYM 905 /* SQL-2003-R */
1207 %token ZEROFILL_SYM 906 /* MYSQL */
1208
1209 /*
1210 Tokens from MySQL 8.0
1211 */
1212 %token JSON_UNQUOTED_SEPARATOR_SYM 907 /* MYSQL */
1213 %token<lexer.keyword> PERSIST_SYM 908 /* MYSQL */
1214 %token<lexer.keyword> ROLE_SYM 909 /* SQL-1999-R */
1215 %token<lexer.keyword> ADMIN_SYM 910 /* SQL-2003-N */
1216 %token<lexer.keyword> INVISIBLE_SYM 911
1217 %token<lexer.keyword> VISIBLE_SYM 912
1218 %token EXCEPT_SYM 913 /* SQL-1999-R */
1219 %token<lexer.keyword> COMPONENT_SYM 914 /* MYSQL */
1220 %token RECURSIVE_SYM 915 /* SQL-1999-R */
1221 %token GRAMMAR_SELECTOR_EXPR 916 /* synthetic token: starts single expr. */
1222 %token GRAMMAR_SELECTOR_GCOL 917 /* synthetic token: starts generated col. */
1223 %token GRAMMAR_SELECTOR_PART 918 /* synthetic token: starts partition expr. */
1224 %token GRAMMAR_SELECTOR_CTE 919 /* synthetic token: starts CTE expr. */
1225 %token JSON_OBJECTAGG 920 /* SQL-2015-R */
1226 %token JSON_ARRAYAGG 921 /* SQL-2015-R */
1227 %token OF_SYM 922 /* SQL-1999-R */
1228 %token<lexer.keyword> SKIP_SYM 923 /* MYSQL */
1229 %token<lexer.keyword> LOCKED_SYM 924 /* MYSQL */
1230 %token<lexer.keyword> NOWAIT_SYM 925 /* MYSQL */
1231 %token GROUPING_SYM 926 /* SQL-2011-R */
1232 %token<lexer.keyword> PERSIST_ONLY_SYM 927 /* MYSQL */
1233 %token<lexer.keyword> HISTOGRAM_SYM 928 /* MYSQL */
1234 %token<lexer.keyword> BUCKETS_SYM 929 /* MYSQL */
1235 %token<lexer.keyword> OBSOLETE_TOKEN_930 930 /* was: REMOTE_SYM */
1236 %token<lexer.keyword> CLONE_SYM 931 /* MYSQL */
1237 %token CUME_DIST_SYM 932 /* SQL-2003-R */
1238 %token DENSE_RANK_SYM 933 /* SQL-2003-R */
1239 %token<lexer.keyword> EXCLUDE_SYM 934 /* SQL-2003-N */
1240 %token FIRST_VALUE_SYM 935 /* SQL-2011-R */
1241 %token<lexer.keyword> FOLLOWING_SYM 936 /* SQL-2003-N */
1242 %token GROUPS_SYM 937 /* SQL-2011-R */
1243 %token LAG_SYM 938 /* SQL-2011-R */
1244 %token LAST_VALUE_SYM 939 /* SQL-2011-R */
1245 %token LEAD_SYM 940 /* SQL-2011-R */
1246 %token NTH_VALUE_SYM 941 /* SQL-2011-R */
1247 %token NTILE_SYM 942 /* SQL-2011-R */
1248 %token<lexer.keyword> NULLS_SYM 943 /* SQL-2003-N */
1249 %token<lexer.keyword> OTHERS_SYM 944 /* SQL-2003-N */
1250 %token OVER_SYM 945 /* SQL-2003-R */
1251 %token PERCENT_RANK_SYM 946 /* SQL-2003-R */
1252 %token<lexer.keyword> PRECEDING_SYM 947 /* SQL-2003-N */
1253 %token RANK_SYM 948 /* SQL-2003-R */
1254 %token<lexer.keyword> RESPECT_SYM 949 /* SQL_2011-N */
1255 %token ROW_NUMBER_SYM 950 /* SQL-2003-R */
1256 %token<lexer.keyword> TIES_SYM 951 /* SQL-2003-N */
1257 %token<lexer.keyword> UNBOUNDED_SYM 952 /* SQL-2003-N */
1258 %token WINDOW_SYM 953 /* SQL-2003-R */
1259 %token EMPTY_SYM 954 /* SQL-2016-R */
1260 %token JSON_TABLE_SYM 955 /* SQL-2016-R */
1261 %token<lexer.keyword> NESTED_SYM 956 /* SQL-2016-N */
1262 %token<lexer.keyword> ORDINALITY_SYM 957 /* SQL-2003-N */
1263 %token<lexer.keyword> PATH_SYM 958 /* SQL-2003-N */
1264 %token<lexer.keyword> HISTORY_SYM 959 /* MYSQL */
1265 %token<lexer.keyword> REUSE_SYM 960 /* MYSQL */
1266 %token<lexer.keyword> SRID_SYM 961 /* MYSQL */
1267 %token<lexer.keyword> THREAD_PRIORITY_SYM 962 /* MYSQL */
1268 %token<lexer.keyword> RESOURCE_SYM 963 /* MYSQL */
1269 %token SYSTEM_SYM 964 /* SQL-2003-R */
1270 %token<lexer.keyword> VCPU_SYM 965 /* MYSQL */
1271 %token<lexer.keyword> MASTER_PUBLIC_KEY_PATH_SYM 966 /* MYSQL */
1272 %token<lexer.keyword> GET_MASTER_PUBLIC_KEY_SYM 967 /* MYSQL */
1273 %token<lexer.keyword> RESTART_SYM 968 /* SQL-2003-N */
1274 %token<lexer.keyword> DEFINITION_SYM 969 /* MYSQL */
1275 %token<lexer.keyword> DESCRIPTION_SYM 970 /* MYSQL */
1276 %token<lexer.keyword> ORGANIZATION_SYM 971 /* MYSQL */
1277 %token<lexer.keyword> REFERENCE_SYM 972 /* MYSQL */
1278 %token<lexer.keyword> ACTIVE_SYM 973 /* MYSQL */
1279 %token<lexer.keyword> INACTIVE_SYM 974 /* MYSQL */
1280 %token LATERAL_SYM 975 /* SQL-1999-R */
1281 %token<lexer.keyword> ARRAY_SYM 976 /* SQL-2003-R */
1282 %token<lexer.keyword> MEMBER_SYM 977 /* SQL-2003-R */
1283 %token<lexer.keyword> OPTIONAL_SYM 978 /* MYSQL */
1284 %token<lexer.keyword> SECONDARY_SYM 979 /* MYSQL */
1285 %token<lexer.keyword> SECONDARY_ENGINE_SYM 980 /* MYSQL */
1286 %token<lexer.keyword> SECONDARY_LOAD_SYM 981 /* MYSQL */
1287 %token<lexer.keyword> SECONDARY_UNLOAD_SYM 982 /* MYSQL */
1288 %token<lexer.keyword> RETAIN_SYM 983 /* MYSQL */
1289 %token<lexer.keyword> OLD_SYM 984 /* SQL-2003-R */
1290 %token<lexer.keyword> ENFORCED_SYM 985 /* SQL-2015-N */
1291 %token<lexer.keyword> OJ_SYM 986 /* ODBC */
1292 %token<lexer.keyword> NETWORK_NAMESPACE_SYM 987 /* MYSQL */
1293 %token<lexer.keyword> RANDOM_SYM 988 /* MYSQL */
1294 %token<lexer.keyword> MASTER_COMPRESSION_ALGORITHM_SYM 989 /* MYSQL */
1295 %token<lexer.keyword> MASTER_ZSTD_COMPRESSION_LEVEL_SYM 990 /* MYSQL */
1296 %token<lexer.keyword> PRIVILEGE_CHECKS_USER_SYM 991 /* MYSQL */
1297 %token<lexer.keyword> MASTER_TLS_CIPHERSUITES_SYM 992 /* MYSQL */
1298 %token<lexer.keyword> REQUIRE_ROW_FORMAT_SYM 993 /* MYSQL */
1299 %token<lexer.keyword> PASSWORD_LOCK_TIME_SYM 994 /* MYSQL */
1300 %token<lexer.keyword> FAILED_LOGIN_ATTEMPTS_SYM 995 /* MYSQL */
1301 %token<lexer.keyword> REQUIRE_TABLE_PRIMARY_KEY_CHECK_SYM 996 /* MYSQL */
1302 %token<lexer.keyword> STREAM_SYM 997 /* MYSQL */
1303 %token<lexer.keyword> OFF_SYM 998 /* SQL-1999-R */
1304 %token<lexer.keyword> RETURNING_SYM 999 /* SQL-2016-N */
1305 /*
1306 Here is an intentional gap in token numbers.
1307
1308 Token numbers starting 1000 till YYUNDEF are occupied by:
1309 1. hint terminals (see sql_hints.yy),
1310 2. digest special internal token numbers (see gen_lex_token.cc, PART 6).
1311
1312 Note: YYUNDEF in internal to Bison. Please don't change its number, or change
1313 it in sync with YYUNDEF in sql_hints.yy.
1314 */
1315 %token YYUNDEF 1150 /* INTERNAL (for use in the lexer) */
1316 %token<lexer.keyword> JSON_VALUE_SYM 1151 /* SQL-2016-R */
1317 %token<lexer.keyword> TLS_SYM 1152 /* MYSQL */
1318 %token<lexer.keyword> ATTRIBUTE_SYM 1153 /* SQL-2003-N */
1319
1320 %token<lexer.keyword> ENGINE_ATTRIBUTE_SYM 1154 /* MYSQL */
1321 %token<lexer.keyword> SECONDARY_ENGINE_ATTRIBUTE_SYM 1155 /* MYSQL */
1322 %token<lexer.keyword> SOURCE_CONNECTION_AUTO_FAILOVER_SYM 1156 /* MYSQL */
1323 %token<lexer.keyword> ZONE_SYM 1157 /* SQL-2003-N */
1324 %token<lexer.keyword> GRAMMAR_SELECTOR_DERIVED_EXPR 1158 /* synthetic token:
1325 starts derived
1326 table expressions. */
1327 %token<lexer.keyword> REPLICA_SYM 1159
1328 %token<lexer.keyword> REPLICAS_SYM 1160
1329 %token<lexer.keyword> ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS_SYM 1161 /* MYSQL */
1330 %token<lexer.keyword> GET_SOURCE_PUBLIC_KEY_SYM 1162 /* MYSQL */
1331 %token<lexer.keyword> SOURCE_AUTO_POSITION_SYM 1163 /* MYSQL */
1332 %token<lexer.keyword> SOURCE_BIND_SYM 1164 /* MYSQL */
1333 %token<lexer.keyword> SOURCE_COMPRESSION_ALGORITHM_SYM 1165 /* MYSQL */
1334 %token<lexer.keyword> SOURCE_CONNECT_RETRY_SYM 1166 /* MYSQL */
1335 %token<lexer.keyword> SOURCE_DELAY_SYM 1167 /* MYSQL */
1336 %token<lexer.keyword> SOURCE_HEARTBEAT_PERIOD_SYM 1168 /* MYSQL */
1337 %token<lexer.keyword> SOURCE_HOST_SYM 1169 /* MYSQL */
1338 %token<lexer.keyword> SOURCE_LOG_FILE_SYM 1170 /* MYSQL */
1339 %token<lexer.keyword> SOURCE_LOG_POS_SYM 1171 /* MYSQL */
1340 %token<lexer.keyword> SOURCE_PASSWORD_SYM 1172 /* MYSQL */
1341 %token<lexer.keyword> SOURCE_PORT_SYM 1173 /* MYSQL */
1342 %token<lexer.keyword> SOURCE_PUBLIC_KEY_PATH_SYM 1174 /* MYSQL */
1343 %token<lexer.keyword> SOURCE_RETRY_COUNT_SYM 1175 /* MYSQL */
1344 %token<lexer.keyword> SOURCE_SSL_SYM 1176 /* MYSQL */
1345 %token<lexer.keyword> SOURCE_SSL_CA_SYM 1177 /* MYSQL */
1346 %token<lexer.keyword> SOURCE_SSL_CAPATH_SYM 1178 /* MYSQL */
1347 %token<lexer.keyword> SOURCE_SSL_CERT_SYM 1179 /* MYSQL */
1348 %token<lexer.keyword> SOURCE_SSL_CIPHER_SYM 1180 /* MYSQL */
1349 %token<lexer.keyword> SOURCE_SSL_CRL_SYM 1181 /* MYSQL */
1350 %token<lexer.keyword> SOURCE_SSL_CRLPATH_SYM 1182 /* MYSQL */
1351 %token<lexer.keyword> SOURCE_SSL_KEY_SYM 1183 /* MYSQL */
1352 %token<lexer.keyword> SOURCE_SSL_VERIFY_SERVER_CERT_SYM 1184 /* MYSQL */
1353 %token<lexer.keyword> SOURCE_TLS_CIPHERSUITES_SYM 1185 /* MYSQL */
1354 %token<lexer.keyword> SOURCE_TLS_VERSION_SYM 1186 /* MYSQL */
1355 %token<lexer.keyword> SOURCE_USER_SYM 1187 /* MYSQL */
1356 %token<lexer.keyword> SOURCE_ZSTD_COMPRESSION_LEVEL_SYM 1188 /* MYSQL */
1357
1358 %token<lexer.keyword> ST_COLLECT_SYM 1189 /* MYSQL */
1359 %token<lexer.keyword> KEYRING_SYM 1190 /* MYSQL */
1360
1361 %token<lexer.keyword> AUTHENTICATION_SYM 1191 /* MYSQL */
1362 %token<lexer.keyword> FACTOR_SYM 1192 /* MYSQL */
1363 %token<lexer.keyword> FINISH_SYM 1193 /* SQL-2016-N */
1364 %token<lexer.keyword> INITIATE_SYM 1194 /* MYSQL */
1365 %token<lexer.keyword> REGISTRATION_SYM 1195 /* MYSQL */
1366 %token<lexer.keyword> UNREGISTER_SYM 1196 /* MYSQL */
1367 %token<lexer.keyword> INITIAL_SYM 1197 /* SQL-2016-R */
1368 %token<lexer.keyword> CHALLENGE_RESPONSE_SYM 1198 /* MYSQL */
1369
1370 %token<lexer.keyword> GTID_ONLY_SYM 1199 /* MYSQL */
1371
1372 /*
1373 Tokens from Percona Server 5.7 and older
1374 */
1375 %token<lexer.keyword> CLIENT_STATS_SYM 1301
1376 %token CLUSTERING_SYM 1302
1377 %token<lexer.keyword> COMPRESSION_DICTIONARY_SYM 1303
1378 %token<lexer.keyword> INDEX_STATS_SYM 1304
1379 %token<lexer.keyword> TABLE_STATS_SYM 1305
1380 %token<lexer.keyword> THREAD_STATS_SYM 1306
1381 %token<lexer.keyword> USER_STATS_SYM 1307
1382 %token<lexer.keyword> ENCRYPTION_KEY_ID_SYM 1308
1383
1384 /*
1385 Tokens from Percona Server 8.0
1386 */
1387 %token<lexer.keyword> EFFECTIVE_SYM 1350
1388 %token SEQUENCE_TABLE_SYM 1351
1389
1390 /*
1391 Precedence rules used to resolve the ambiguity when using keywords as idents
1392 in the case e.g.:
1393
1394 SELECT TIMESTAMP'...'
1395
1396 vs.
1397
1398 CREATE TABLE t1 ( timestamp INT );
1399
1400 The use as an ident is allowed, but must never take precedence over the use
1401 as an actual keyword. Hence we declare the fake token KEYWORD_USED_AS_IDENT
1402 to have the lowest possible precedence, KEYWORD_USED_AS_KEYWORD need only be
1403 a bit higher. The TEXT_STRING token is added here to resolve the ambiguity
1404 in the above example.
1405 */
1406 %left KEYWORD_USED_AS_IDENT
1407 %nonassoc TEXT_STRING
1408 %left KEYWORD_USED_AS_KEYWORD
1409
1410
1411 /*
1412 Resolve column attribute ambiguity -- force precedence of "UNIQUE KEY" against
1413 simple "UNIQUE" and "KEY" attributes:
1414 */
1415 %right UNIQUE_SYM KEY_SYM
1416
1417 %left CONDITIONLESS_JOIN
1418 %left JOIN_SYM INNER_SYM CROSS STRAIGHT_JOIN NATURAL LEFT RIGHT ON_SYM USING
1419 %left SET_VAR
1420 %left OR_SYM OR2_SYM
1421 %left XOR
1422 %left AND_SYM AND_AND_SYM
1423 %left BETWEEN_SYM CASE_SYM WHEN_SYM THEN_SYM ELSE
1424 %left EQ EQUAL_SYM GE GT_SYM LE LT NE IS LIKE REGEXP IN_SYM
1425 %left '|'
1426 %left '&'
1427 %left SHIFT_LEFT SHIFT_RIGHT
1428 %left '-' '+'
1429 %left '*' '/' '%' DIV_SYM MOD_SYM
1430 %left '^'
1431 %left OR_OR_SYM
1432 %left NEG '~'
1433 %right NOT_SYM NOT2_SYM
1434 %right BINARY_SYM COLLATE_SYM
1435 %left INTERVAL_SYM
1436 %left SUBQUERY_AS_EXPR
1437 %left '(' ')'
1438
1439 %left EMPTY_FROM_CLAUSE
1440 %right INTO
1441
1442 %type <lexer.lex_str>
1443 IDENT IDENT_QUOTED TEXT_STRING DECIMAL_NUM FLOAT_NUM NUM LONG_NUM HEX_NUM
1444 LEX_HOSTNAME ULONGLONG_NUM select_alias ident opt_ident ident_or_text
1445 role_ident role_ident_or_text
1446 IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
1447 NCHAR_STRING
1448 BIN_NUM TEXT_STRING_filesystem ident_or_empty
1449 TEXT_STRING_sys_nonewline TEXT_STRING_password TEXT_STRING_hash
1450 TEXT_STRING_validated
1451 filter_wild_db_table_string
1452 opt_constraint_name
1453 ts_datafile lg_undofile /*lg_redofile*/ opt_logfile_group_name opt_ts_datafile_name
1454 opt_describe_column
1455 opt_datadir_ssl default_encryption
1456 lvalue_ident
1457 schema
1458 engine_or_all
1459 opt_binlog_in
1460
1461 %type <lex_cstr>
1462 key_cache_name
1463 label_ident
1464 opt_table_alias
1465 opt_with_compression_dictionary
1466 opt_replace_password
1467 sp_opt_label
1468 json_attribute
1469 opt_channel
1470
1471 %type <lex_str_list> TEXT_STRING_sys_list
1472
1473 %type <table>
1474 table_ident
1475
1476 %type <simple_string>
1477 opt_db
1478
1479 %type <string>
1480 text_string opt_gconcat_separator
1481 opt_xml_rows_identified_by
1482
1483 %type <num>
1484 lock_option
1485 udf_type if_exists
1486 opt_no_write_to_binlog
1487 all_or_any opt_distinct
1488 fulltext_options union_option
1489 transaction_access_mode_types
1490 opt_natural_language_mode opt_query_expansion
1491 opt_ev_status opt_ev_on_completion ev_on_completion opt_ev_comment
1492 ev_alter_on_schedule_completion opt_ev_rename_to opt_ev_sql_stmt
1493 trg_action_time trg_event
1494 view_check_option
1495 signed_num
1496 opt_num_buckets
1497 opt_ignore_unknown_user
1498
1499
1500 %type <order_direction>
1501 ordering_direction opt_ordering_direction
1502
1503 /*
1504 Bit field of MYSQL_START_TRANS_OPT_* flags.
1505 */
1506 %type <num> opt_start_transaction_option_list
1507 %type <num> start_transaction_option_list
1508 %type <num> start_transaction_option
1509
1510 %type <m_yes_no_unk>
1511 opt_chain opt_release
1512
1513 %type <m_fk_option>
1514 delete_option
1515
1516 %type <ulong_num>
1517 ulong_num real_ulong_num merge_insert_types
1518 ws_num_codepoints func_datetime_precision
1519 now
1520 opt_checksum_type
1521 opt_ignore_lines
1522 opt_profile_defs
1523 profile_defs
1524 profile_def
1525 factor
1526
1527 %type <ulonglong_number>
1528 ulonglong_num real_ulonglong_num size_number
1529 option_autoextend_size
1530
1531 %type <lock_type>
1532 replace_lock_option opt_low_priority insert_lock_option load_data_lock
1533
1534 %type <locked_row_action> locked_row_action opt_locked_row_action
1535
1536 %type <item>
1537 literal insert_ident temporal_literal
1538 simple_ident expr opt_expr opt_else
1539 set_function_specification sum_expr
1540 in_sum_expr grouping_operation
1541 window_func_call opt_ll_default
1542 bool_pri
1543 predicate bit_expr
1544 table_wild simple_expr udf_expr
1545 expr_or_default set_expr_or_default
1546 geometry_function
1547 signed_literal now_or_signed_literal
1548 simple_ident_nospvar simple_ident_q
1549 field_or_var limit_option
1550 function_call_keyword
1551 function_call_nonkeyword
1552 function_call_generic
1553 function_call_conflict
1554 signal_allowed_expr
1555 simple_target_specification
1556 condition_number
1557 create_compression_dictionary_allowed_expr
1558 filter_db_ident
1559 filter_table_ident
1560 filter_string
1561 select_item
1562 opt_where_clause
1563 where_clause
1564 opt_having_clause
1565 opt_simple_limit
1566 null_as_literal
1567 literal_or_null
1568 signed_literal_or_null
1569 stable_integer
1570 param_or_var
1571 in_expression_user_variable_assignment
1572 rvalue_system_or_user_variable
1573
1574 %type <item_string> window_name opt_existing_window_name
1575
1576 %type <item_num> NUM_literal
1577 int64_literal
1578
1579 %type <item_list>
1580 when_list
1581 opt_filter_db_list filter_db_list
1582 opt_filter_table_list filter_table_list
1583 opt_filter_string_list filter_string_list
1584 opt_filter_db_pair_list filter_db_pair_list
1585
1586 %type <item_list2>
1587 expr_list udf_expr_list opt_udf_expr_list opt_expr_list select_item_list
1588 opt_paren_expr_list ident_list_arg ident_list values opt_values row_value fields
1589 fields_or_vars
1590 opt_field_or_var_spec
1591 row_value_explicit
1592
1593 %type <var_type>
1594 option_type opt_var_type opt_rvalue_system_variable_type opt_set_var_ident_type
1595
1596 %type <key_type>
1597 constraint_key_type opt_unique_combo_clustering unique_combo_clustering
1598
1599 %type <key_alg>
1600 index_type
1601
1602 %type <string_list>
1603 string_list using_list opt_use_partition use_partition ident_string_list
1604 all_or_alt_part_name_list
1605
1606 %type <key_part>
1607 key_part key_part_with_expression
1608
1609 %type <date_time_type> date_time_type;
1610 %type <interval> interval
1611
1612 %type <interval_time_st> interval_time_stamp
1613
1614 %type <row_type> row_types
1615
1616 %type <resource_group_type> resource_group_types
1617
1618 %type <resource_group_vcpu_list_type>
1619 opt_resource_group_vcpu_list
1620 vcpu_range_spec_list
1621
1622 %type <resource_group_priority_type> opt_resource_group_priority
1623
1624 %type <resource_group_state_type> opt_resource_group_enable_disable
1625
1626 %type <resource_group_flag_type> opt_force
1627
1628 %type <thread_id_list_type> thread_id_list thread_id_list_options
1629
1630 %type <vcpu_range_type> vcpu_num_or_range
1631
1632 %type <tx_isolation> isolation_types
1633
1634 %type <ha_rkey_mode> handler_rkey_mode
1635
1636 %type <ha_read_mode> handler_scan_function
1637 handler_rkey_function
1638
1639 %type <cast_type> cast_type opt_returning_type
1640
1641 %type <lexer.keyword> ident_keyword label_keyword role_keyword
1642 lvalue_keyword
1643 ident_keywords_unambiguous
1644 ident_keywords_ambiguous_1_roles_and_labels
1645 ident_keywords_ambiguous_2_labels
1646 ident_keywords_ambiguous_3_roles
1647 ident_keywords_ambiguous_4_system_variables
1648
1649 %type <lex_user> user_ident_or_text user create_user alter_user user_func role
1650
1651 %type <lex_mfa>
1652 identification
1653 identified_by_password
1654 identified_by_random_password
1655 identified_with_plugin
1656 identified_with_plugin_as_auth
1657 identified_with_plugin_by_random_password
1658 identified_with_plugin_by_password
1659 opt_initial_auth
1660 opt_user_registration
1661
1662 %type <lex_mfas> opt_create_user_with_mfa
1663
1664 %type <lexer.charset>
1665 opt_collate
1666 charset_name
1667 old_or_new_charset_name
1668 old_or_new_charset_name_or_default
1669 collation_name
1670 opt_load_data_charset
1671 UNDERSCORE_CHARSET
1672 ascii unicode
1673 default_charset default_collation
1674
1675 %type <boolfunc2creator> comp_op
1676
1677 %type <num> sp_decl_idents sp_opt_inout sp_handler_type sp_hcond_list
1678 %type <spcondvalue> sp_cond sp_hcond sqlstate signal_value opt_signal_value
1679 %type <spblock> sp_decls sp_decl
1680 %type <spname> sp_name
1681 %type <index_hint> index_hint_type
1682 %type <num> index_hint_clause
1683 %type <filetype> data_or_xml
1684
1685 %type <da_condition_item_name> signal_condition_information_item_name
1686
1687 %type <diag_area> which_area;
1688 %type <diag_info> diagnostics_information;
1689 %type <stmt_info_item> statement_information_item;
1690 %type <stmt_info_item_name> statement_information_item_name;
1691 %type <stmt_info_list> statement_information;
1692 %type <cond_info_item> condition_information_item;
1693 %type <cond_info_item_name> condition_information_item_name;
1694 %type <cond_info_list> condition_information;
1695 %type <signal_item_list> signal_information_item_list;
1696 %type <signal_item_list> opt_set_signal_information;
1697
1698 %type <trg_characteristics> trigger_follows_precedes_clause;
1699 %type <trigger_action_order_type> trigger_action_order;
1700
1701 %type <xid> xid;
1702 %type <xa_option_type> opt_join_or_resume;
1703 %type <xa_option_type> opt_suspend;
1704 %type <xa_option_type> opt_one_phase;
1705
1706 %type <is_not_empty> opt_convert_xid opt_ignore opt_linear opt_bin_mod
1707 opt_if_not_exists opt_temporary
1708 opt_grant_option opt_with_admin_option
1709 opt_full opt_extended
1710 opt_ignore_leaves
1711 opt_local
1712 opt_retain_current_password
1713 opt_discard_old_password
1714 opt_constraint_enforcement
1715 constraint_enforcement
1716 opt_not
1717 opt_interval
1718
1719 %type <show_cmd_type> opt_show_cmd_type
1720
1721 /*
1722 A bit field of SLAVE_IO, SLAVE_SQL flags.
1723 */
1724 %type <num> opt_replica_thread_option_list
1725 %type <num> replica_thread_option_list
1726 %type <num> replica_thread_option
1727
1728 %type <key_usage_element> key_usage_element
1729
1730 %type <key_usage_list> key_usage_list opt_key_usage_list index_hint_definition
1731 index_hints_list opt_index_hints_list opt_key_definition
1732 opt_cache_key_list
1733
1734 %type <order_expr> order_expr alter_order_item
1735 grouping_expr
1736
1737 %type <order_list> order_list group_list gorder_list opt_gorder_clause
1738 alter_order_list opt_partition_clause opt_window_order_by_clause
1739
1740 %type <c_str> field_length opt_field_length type_datetime_precision
1741 opt_place
1742
1743 %type <precision> precision opt_precision float_options standard_float_options
1744
1745 %type <charset_with_opt_binary> opt_charset_with_opt_binary
1746
1747 %type <limit_options> limit_options
1748
1749 %type <limit_clause> limit_clause opt_limit_clause
1750
1751 %type <ulonglong_number> query_spec_option
1752
1753 %type <select_options> select_option select_option_list select_options
1754
1755 %type <node>
1756 option_value
1757
1758 %type <join_table> joined_table joined_table_parens
1759
1760 %type <table_reference_list> opt_from_clause from_clause from_tables
1761 table_reference_list table_reference_list_parens explicit_table
1762
1763 %type <olap_type> olap_opt
1764
1765 %type <group> opt_group_clause
1766
1767 %type <windows> opt_window_clause ///< Definition of named windows
1768 ///< for the query specification
1769 window_definition_list
1770
1771 %type <window> window_definition window_spec window_spec_details window_name_or_spec
1772 windowing_clause ///< Definition of unnamed window near the window function.
1773 opt_windowing_clause ///< For functions which can be either set or window
1774 ///< functions (e.g. SUM), non-empty clause makes the difference.
1775
1776 %type <window_frame> opt_window_frame_clause
1777
1778 %type <frame_units> window_frame_units
1779
1780 %type <frame_extent> window_frame_extent window_frame_between
1781
1782 %type <bound> window_frame_start window_frame_bound
1783
1784 %type <frame_exclusion> opt_window_frame_exclusion
1785
1786 %type <null_treatment> opt_null_treatment
1787
1788 %type <lead_lag_info> opt_lead_lag_info
1789
1790 %type <from_first_last> opt_from_first_last
1791
1792 %type <order> order_clause opt_order_clause
1793
1794 %type <locking_clause> locking_clause
1795
1796 %type <locking_clause_list> locking_clause_list
1797
1798 %type <lock_strength> lock_strength
1799
1800 %type <table_reference> table_reference esc_table_reference
1801 table_factor single_table single_table_parens table_function
1802
1803 %type <query_expression_body> query_expression_body
1804
1805 %type <bipartite_name> lvalue_variable rvalue_system_variable
1806
1807 %type <option_value_following_option_type> option_value_following_option_type
1808
1809 %type <option_value_no_option_type> option_value_no_option_type
1810
1811 %type <option_value_list> option_value_list option_value_list_continued
1812
1813 %type <start_option_value_list> start_option_value_list
1814
1815 %type <transaction_access_mode> transaction_access_mode
1816 opt_transaction_access_mode
1817
1818 %type <isolation_level> isolation_level opt_isolation_level
1819
1820 %type <transaction_characteristics> transaction_characteristics
1821
1822 %type <start_option_value_list_following_option_type>
1823 start_option_value_list_following_option_type
1824
1825 %type <set> set
1826
1827 %type <line_separators> line_term line_term_list opt_line_term
1828
1829 %type <field_separators> field_term field_term_list opt_field_term
1830
1831 %type <into_destination> into_destination into_clause
1832
1833 %type <select_var_ident> select_var_ident
1834
1835 %type <select_var_list> select_var_list
1836
1837 %type <query_primary>
1838 as_create_query_expression
1839 query_expression_or_parens
1840 query_expression_parens
1841 query_primary
1842 query_specification
1843
1844 %type <query_expression> query_expression
1845
1846 %type <subquery> subquery row_subquery table_subquery
1847
1848 %type <derived_table> derived_table
1849
1850 %type <param_marker> param_marker
1851
1852 %type <text_literal> text_literal
1853
1854 %type <top_level_node>
1855 alter_instance_stmt
1856 alter_resource_group_stmt
1857 alter_table_stmt
1858 analyze_table_stmt
1859 call_stmt
1860 check_table_stmt
1861 create_index_stmt
1862 create_resource_group_stmt
1863 create_role_stmt
1864 create_srs_stmt
1865 create_table_stmt
1866 delete_stmt
1867 describe_stmt
1868 do_stmt
1869 drop_index_stmt
1870 drop_resource_group_stmt
1871 drop_role_stmt
1872 drop_srs_stmt
1873 explain_stmt
1874 explainable_stmt
1875 handler_stmt
1876 insert_stmt
1877 keycache_stmt
1878 load_stmt
1879 optimize_table_stmt
1880 preload_stmt
1881 repair_table_stmt
1882 replace_stmt
1883 restart_server_stmt
1884 select_stmt
1885 select_stmt_with_into
1886 set_resource_group_stmt
1887 set_role_stmt
1888 show_binary_logs_stmt
1889 show_binlog_events_stmt
1890 show_character_set_stmt
1891 show_collation_stmt
1892 show_columns_stmt
1893 show_count_errors_stmt
1894 show_count_warnings_stmt
1895 show_create_database_stmt
1896 show_create_event_stmt
1897 show_create_function_stmt
1898 show_create_procedure_stmt
1899 show_create_table_stmt
1900 show_create_trigger_stmt
1901 show_create_user_stmt
1902 show_create_view_stmt
1903 show_databases_stmt
1904 show_engine_logs_stmt
1905 show_engine_mutex_stmt
1906 show_engine_status_stmt
1907 show_engines_stmt
1908 show_errors_stmt
1909 show_events_stmt
1910 show_function_code_stmt
1911 show_function_status_stmt
1912 show_grants_stmt
1913 show_keys_stmt
1914 show_master_status_stmt
1915 show_open_tables_stmt
1916 show_plugins_stmt
1917 show_privileges_stmt
1918 show_procedure_code_stmt
1919 show_procedure_status_stmt
1920 show_processlist_stmt
1921 show_profile_stmt
1922 show_profiles_stmt
1923 show_relaylog_events_stmt
1924 show_replica_status_stmt
1925 show_replicas_stmt
1926 show_stats_stmt
1927 show_status_stmt
1928 show_table_status_stmt
1929 show_tables_stmt
1930 show_triggers_stmt
1931 show_variables_stmt
1932 show_warnings_stmt
1933 shutdown_stmt
1934 simple_statement
1935 truncate_stmt
1936 update_stmt
1937
1938 %type <table_ident> table_ident_opt_wild
1939
1940 %type <table_ident_list> table_alias_ref_list table_locking_list
1941
1942 %type <simple_ident_list> simple_ident_list opt_derived_column_list
1943
1944 %type <num> opt_delete_options
1945
1946 %type <opt_delete_option> opt_delete_option
1947
1948 %type <column_value_pair>
1949 update_elem
1950
1951 %type <column_value_list_pair>
1952 update_list
1953 opt_insert_update_list
1954
1955 %type <values_list> values_list insert_values table_value_constructor
1956 values_row_list
1957
1958 %type <insert_query_expression> insert_query_expression
1959
1960 %type <column_row_value_list_pair> insert_from_constructor
1961
1962 %type <lexer.optimizer_hints> SELECT_SYM INSERT_SYM REPLACE_SYM UPDATE_SYM DELETE_SYM
1963 OPTIMIZE CALL_SYM ALTER ANALYZE_SYM CHECK_SYM LOAD CREATE
1964
1965 %type <join_type> outer_join_type natural_join_type inner_join_type
1966
1967 %type <user_list> user_list role_list default_role_clause opt_except_role_list
1968
1969 %type <alter_instance_cmd> alter_instance_action
1970
1971 %type <index_column_list> key_list key_list_with_expression
1972
1973 %type <index_options> opt_index_options index_options opt_fulltext_index_options
1974 fulltext_index_options opt_spatial_index_options spatial_index_options
1975
1976 %type <opt_index_lock_and_algorithm> opt_index_lock_and_algorithm
1977
1978 %type <index_option> index_option common_index_option fulltext_index_option
1979 spatial_index_option
1980 index_type_clause
1981 opt_index_type_clause
1982
1983 %type <alter_table_algorithm> alter_algorithm_option_value
1984 alter_algorithm_option
1985
1986 %type <alter_table_lock> alter_lock_option_value alter_lock_option
1987
1988 %type <table_constraint_def> table_constraint_def
1989
1990 %type <index_name_and_type> opt_index_name_and_type
1991
1992 %type <visibility> visibility
1993
1994 %type <with_clause> with_clause opt_with_clause
1995 %type <with_list> with_list
1996 %type <common_table_expr> common_table_expr
1997
1998 %type <partition_option> part_option
1999
2000 %type <partition_option_list> opt_part_options part_option_list
2001
2002 %type <sub_part_definition> sub_part_definition
2003
2004 %type <sub_part_list> sub_part_list opt_sub_partition
2005
2006 %type <part_value_item> part_value_item
2007
2008 %type <part_value_item_list> part_value_item_list
2009
2010 %type <part_value_item_list_paren> part_value_item_list_paren part_func_max
2011
2012 %type <part_value_list> part_value_list
2013
2014 %type <part_values> part_values_in
2015
2016 %type <opt_part_values> opt_part_values
2017
2018 %type <part_definition> part_definition
2019
2020 %type <part_def_list> part_def_list opt_part_defs
2021
2022 %type <ulong_num> opt_num_subparts opt_num_parts
2023
2024 %type <name_list> name_list opt_name_list
2025
2026 %type <opt_key_algo> opt_key_algo
2027
2028 %type <opt_sub_part> opt_sub_part
2029
2030 %type <part_type_def> part_type_def
2031
2032 %type <partition_clause> partition_clause
2033
2034 %type <mi_type> mi_repair_type mi_repair_types opt_mi_repair_types
2035 mi_check_type mi_check_types opt_mi_check_types
2036
2037 %type <opt_restrict> opt_restrict;
2038
2039 %type <table_list> table_list opt_table_list
2040
2041 %type <ternary_option> ternary_option;
2042
2043 %type <create_table_option> create_table_option
2044
2045 %type <create_table_options> create_table_options
2046
2047 %type <space_separated_alter_table_opts> create_table_options_space_separated
2048
2049 %type <on_duplicate> duplicate opt_duplicate
2050
2051 %type <col_attr> column_attribute
2052
2053 %type <column_format> column_format
2054
2055 %type <storage_media> storage_media
2056
2057 %type <col_attr_list> column_attribute_list opt_column_attribute_list
2058
2059 %type <virtual_or_stored> opt_stored_attribute
2060
2061 %type <field_option> field_option field_opt_list field_options
2062
2063 %type <int_type> int_type
2064
2065 %type <type> spatial_type type
2066
2067 %type <numeric_type> real_type numeric_type
2068
2069 %type <sp_default> sp_opt_default
2070
2071 %type <field_def> field_def
2072
2073 %type <item> check_constraint
2074
2075 %type <table_constraint_def> opt_references
2076
2077 %type <fk_options> opt_on_update_delete
2078
2079 %type <opt_match_clause> opt_match_clause
2080
2081 %type <reference_list> reference_list opt_ref_list
2082
2083 %type <fk_references> references
2084
2085 %type <column_def> column_def
2086
2087 %type <table_element> table_element
2088
2089 %type <table_element_list> table_element_list
2090
2091 %type <create_table_tail> opt_create_table_options_etc
2092 opt_create_partitioning_etc opt_duplicate_as_qe
2093
2094 %type <wild_or_where> opt_wild_or_where
2095
2096 // used by JSON_TABLE
2097 %type <jtc_list> columns_clause columns_list
2098 %type <jt_column> jt_column
2099 %type <json_on_response> json_on_response on_empty on_error
2100 %type <json_on_error_or_empty> opt_on_empty_or_error
2101 opt_on_empty_or_error_json_table
2102 %type <jt_column_type> jt_column_type
2103
2104 %type <acl_type> opt_acl_type
2105 %type <histogram> opt_histogram
2106
2107 %type <lex_cstring_list> column_list opt_column_list
2108
2109 %type <role_or_privilege> role_or_privilege
2110
2111 %type <role_or_privilege_list> role_or_privilege_list
2112
2113 %type <with_validation> with_validation opt_with_validation
2114 /*%type <ts_access_mode> ts_access_mode*/
2115
2116 %type <alter_table_action> alter_list_item alter_table_partition_options
2117 %type <ts_options> logfile_group_option_list opt_logfile_group_options
2118 alter_logfile_group_option_list opt_alter_logfile_group_options
2119 tablespace_option_list opt_tablespace_options
2120 alter_tablespace_option_list opt_alter_tablespace_options
2121 opt_drop_ts_options drop_ts_option_list
2122 undo_tablespace_option_list opt_undo_tablespace_options
2123
2124 %type <alter_table_standalone_action> standalone_alter_commands
2125
2126 %type <algo_and_lock_and_validation>alter_commands_modifier
2127 alter_commands_modifier_list
2128
2129 %type <alter_list> alter_list opt_alter_command_list opt_alter_table_actions
2130
2131 %type <standalone_alter_table_action> standalone_alter_table_action
2132
2133 %type <assign_to_keycache> assign_to_keycache
2134
2135 %type <keycache_list> keycache_list
2136
2137 %type <adm_partition> adm_partition
2138
2139 %type <preload_keys> preload_keys
2140
2141 %type <preload_list> preload_list
2142 %type <ts_option>
2143 alter_logfile_group_option
2144 alter_tablespace_option
2145 drop_ts_option
2146 logfile_group_option
2147 tablespace_option
2148 undo_tablespace_option
2149 ts_option_autoextend_size
2150 ts_option_comment
2151 ts_option_engine
2152 ts_option_extent_size
2153 ts_option_file_block_size
2154 ts_option_initial_size
2155 ts_option_max_size
2156 ts_option_nodegroup
2157 ts_option_redo_buffer_size
2158 ts_option_undo_buffer_size
2159 ts_option_wait
2160 ts_option_encryption
2161 ts_option_encryption_key_id
2162 ts_option_engine_attribute
2163
2164 %type <explain_format_type> opt_explain_format_type
2165 %type <explain_format_type> opt_explain_analyze_type
2166
2167 %type <load_set_element> load_data_set_elem
2168
2169 %type <load_set_list> load_data_set_list opt_load_data_set_spec
2170
2171 %type <num> opt_array_cast
2172 %type <sql_cmd_srs_attributes> srs_attributes
2173
2174 %type <insert_update_values_reference> opt_values_reference
2175
2176 %type <alter_tablespace_type> undo_tablespace_state
2177
2178 %type <query_id> opt_for_query
2179
2180 %%
2181
2182 /*
2183 Indentation of grammar rules:
2184
2185 rule: <-- starts at col 1
2186 rule1a rule1b rule1c <-- starts at col 11
2187 { <-- starts at col 11
2188 code <-- starts at col 13, indentation is 2 spaces
2189 }
2190 | rule2a rule2b
2191 {
2192 code
2193 }
2194 ; <-- on a line by itself, starts at col 9
2195
2196 Also, please do not use any <TAB>, but spaces.
2197 Having a uniform indentation in this file helps
2198 code reviews, patches, merges, and make maintenance easier.
2199 Tip: grep [[:cntrl:]] sql_yacc.yy
2200 Thanks.
2201 */
2202
2203 start_entry:
2204 sql_statement
2205 | GRAMMAR_SELECTOR_EXPR bit_expr END_OF_INPUT
2206 {
2207 ITEMIZE($2, &$2);
2208 static_cast<Expression_parser_state *>(YYP)->result= $2;
2209 }
2210 | GRAMMAR_SELECTOR_PART partition_clause END_OF_INPUT
2211 {
2212 /*
2213 We enter here when translating partition info string into
2214 partition_info data structure.
2215 */
2216
7/14
✓ Branch 0 taken 19787 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 19787 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 19787 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 19787 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 19787 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 19787 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 19787 times.
19787 CONTEXTUALIZE($2);
2217 19787 static_cast<Partition_expr_parser_state *>(YYP)->result=
2218 19787 &$2->part_info;
2219 }
2220 | GRAMMAR_SELECTOR_GCOL IDENT_sys '(' expr ')' END_OF_INPUT
2221 {
2222 /*
2223 We enter here when translating generated column info string into
2224 partition_info data structure.
2225 */
2226
2227 // Check gcol expression for the "PARSE_GCOL_EXPR" prefix:
2228
2/4
✓ Branch 0 taken 90915 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 90915 times.
90915 if (!is_identifier($2, "PARSE_GCOL_EXPR"))
2229 MYSQL_YYABORT;
2230
2231
1/2
✓ Branch 0 taken 90915 times.
✗ Branch 1 not taken.
90915 auto gcol_info= NEW_PTN Value_generator;
2232
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 90915 times.
90915 if (gcol_info == NULL)
2233 MYSQL_YYABORT; // OOM
2234
9/14
✓ Branch 0 taken 90915 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 90915 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 90915 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 90915 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 90915 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 90914 times.
✓ Branch 12 taken 1 times.
✓ Branch 13 taken 90914 times.
90915 ITEMIZE($4, &$4);
2235 90914 gcol_info->expr_item= $4;
2236 90914 static_cast<Gcol_expr_parser_state *>(YYP)->result= gcol_info;
2237 }
2238 | GRAMMAR_SELECTOR_CTE table_subquery END_OF_INPUT
2239 {
2240 5727 static_cast<Common_table_expr_parser_state *>(YYP)->result= $2;
2241 }
2242 | GRAMMAR_SELECTOR_DERIVED_EXPR expr END_OF_INPUT
2243 {
2244
7/14
✓ Branch 0 taken 118421 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 118421 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 118421 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 118421 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 118421 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 118421 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 118421 times.
118421 ITEMIZE($2, &$2);
2245 118421 static_cast<Derived_expr_parser_state *>(YYP)->result= $2;
2246 }
2247 ;
2248
2249 sql_statement:
2250 END_OF_INPUT
2251 {
2252 15812 THD *thd= YYTHD;
2253
4/4
✓ Branch 0 taken 14005 times.
✓ Branch 1 taken 1805 times.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 15802 times.
29818 if (!thd->is_bootstrap_system_thread() &&
2254
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 13997 times.
14005 !thd->m_parser_state->has_comment())
2255 {
2256
1/2
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
9 my_error(ER_EMPTY_QUERY, MYF(0));
2257 9 MYSQL_YYABORT;
2258 }
2259 15802 thd->lex->sql_command= SQLCOM_EMPTY_QUERY;
2260 15802 YYLIP->found_semicolon= NULL;
2261 }
2262 | simple_statement_or_begin
2263 {
2264 2731987 Lex_input_stream *lip = YYLIP;
2265
2266
1/2
✓ Branch 0 taken 2731987 times.
✗ Branch 1 not taken.
2731987 if (YYTHD->get_protocol()->has_client_capability(CLIENT_MULTI_QUERIES) &&
2267
6/6
✓ Branch 0 taken 81152 times.
✓ Branch 1 taken 2650835 times.
✓ Branch 2 taken 81106 times.
✓ Branch 3 taken 46 times.
✓ Branch 4 taken 81074 times.
✓ Branch 5 taken 2650913 times.
2813093 lip->multi_statements &&
2268
2/2
✓ Branch 0 taken 81074 times.
✓ Branch 1 taken 32 times.
81106 ! lip->eof())
2269 {
2270 /*
2271 We found a well formed query, and multi queries are allowed:
2272 - force the parser to stop after the ';'
2273 - mark the start of the next query for the next invocation
2274 of the parser.
2275 */
2276 81074 lip->next_state= MY_LEX_END;
2277 81074 lip->found_semicolon= lip->get_ptr();
2278 }
2279 else
2280 {
2281 /* Single query, terminated. */
2282 2650913 lip->found_semicolon= NULL;
2283 }
2284 }
2285 ';'
2286 opt_end_of_input
2287 | simple_statement_or_begin END_OF_INPUT
2288 {
2289 /* Single query, not terminated. */
2290 19733033 YYLIP->found_semicolon= NULL;
2291 }
2292 ;
2293
2294 opt_end_of_input:
2295 /* empty */
2296 | END_OF_INPUT
2297 ;
2298
2299 simple_statement_or_begin:
2300 22116829 simple_statement { *parse_tree= $1; }
2301 | begin_stmt
2302 ;
2303
2304 /* Verb clauses, except begin_stmt */
2305 simple_statement:
2306 1104 alter_database_stmt { $$= nullptr; }
2307 227 | alter_event_stmt { $$= nullptr; }
2308 175 | alter_function_stmt { $$= nullptr; }
2309 | alter_instance_stmt
2310 4 | alter_logfile_stmt { $$= nullptr; }
2311 212 | alter_procedure_stmt { $$= nullptr; }
2312 | alter_resource_group_stmt
2313 15 | alter_server_stmt { $$= nullptr; }
2314 660 | alter_tablespace_stmt { $$= nullptr; }
2315 565 | alter_undo_tablespace_stmt { $$= nullptr; }
2316 | alter_table_stmt
2317 2005 | alter_user_stmt { $$= nullptr; }
2318 8653 | alter_view_stmt { $$= nullptr; }
2319 | analyze_table_stmt
2320 3467 | binlog_base64_event { $$= nullptr; }
2321 | call_stmt
2322 8199 | change { $$= nullptr; }
2323 | check_table_stmt
2324 28214 | checksum { $$= nullptr; }
2325 357 | clone_stmt { $$= nullptr; }
2326 174947 | commit { $$= nullptr; }
2327 400620 | create { $$= nullptr; }
2328 | create_index_stmt
2329 | create_resource_group_stmt
2330 | create_role_stmt
2331 | create_srs_stmt
2332 | create_table_stmt
2333 41417 | deallocate { $$= nullptr; }
2334 | delete_stmt
2335 | describe_stmt
2336 | do_stmt
2337 6855 | drop_database_stmt { $$= nullptr; }
2338 520 | drop_event_stmt { $$= nullptr; }
2339 19769 | drop_function_stmt { $$= nullptr; }
2340 | drop_index_stmt
2341 4 | drop_logfile_stmt { $$= nullptr; }
2342 20669 | drop_procedure_stmt { $$= nullptr; }
2343 | drop_resource_group_stmt
2344 | drop_role_stmt
2345 143 | drop_server_stmt { $$= nullptr; }
2346 | drop_srs_stmt
2347 932 | drop_tablespace_stmt { $$= nullptr; }
2348 355 | drop_undo_tablespace_stmt { $$= nullptr; }
2349 166133 | drop_table_stmt { $$= nullptr; }
2350 5180 | drop_trigger_stmt { $$= nullptr; }
2351 4681 | drop_user_stmt { $$= nullptr; }
2352 4005 | drop_view_stmt { $$= nullptr; }
2353 79671 | execute { $$= nullptr; }
2354 | explain_stmt
2355 24335 | flush { $$= nullptr; }
2356 860 | get_diagnostics { $$= nullptr; }
2357 4248 | group_replication { $$= nullptr; }
2358 11026 | grant { $$= nullptr; }
2359 | handler_stmt
2360 22 | help { $$= nullptr; }
2361 36 | import_stmt { $$= nullptr; }
2362 | insert_stmt
2363 1418 | install { $$= nullptr; }
2364 2728 | kill { $$= nullptr; }
2365 | load_stmt
2366 3053 | lock { $$= nullptr; }
2367 | optimize_table_stmt
2368 | keycache_stmt
2369 | preload_stmt
2370 45662 | prepare { $$= nullptr; }
2371 160 | purge { $$= nullptr; }
2372 85 | release { $$= nullptr; }
2373 10311 | rename { $$= nullptr; }
2374 | repair_table_stmt
2375 | replace_stmt
2376 26994 | reset { $$= nullptr; }
2377 243 | resignal_stmt { $$= nullptr; }
2378 | restart_server_stmt
2379 3636 | revoke { $$= nullptr; }
2380 12497 | rollback { $$= nullptr; }
2381 6170 | savepoint { $$= nullptr; }
2382 | select_stmt
2383
10/14
✓ Branch 0 taken 1432284 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1432310 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1432309 times.
✓ Branch 5 taken 1 times.
✓ Branch 6 taken 1432311 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1432280 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 197 times.
✓ Branch 11 taken 1432083 times.
✓ Branch 12 taken 198 times.
✓ Branch 13 taken 1432081 times.
1432276 | set { $$= nullptr; CONTEXTUALIZE($1); }
2384 | set_resource_group_stmt
2385 | set_role_stmt
2386 | show_binary_logs_stmt
2387 | show_binlog_events_stmt
2388 | show_character_set_stmt
2389 | show_collation_stmt
2390 | show_columns_stmt
2391 | show_count_errors_stmt
2392 | show_count_warnings_stmt
2393 | show_create_database_stmt
2394 | show_create_event_stmt
2395 | show_create_function_stmt
2396 | show_create_procedure_stmt
2397 | show_create_table_stmt
2398 | show_create_trigger_stmt
2399 | show_create_user_stmt
2400 | show_create_view_stmt
2401 | show_databases_stmt
2402 | show_engine_logs_stmt
2403 | show_engine_mutex_stmt
2404 | show_engine_status_stmt
2405 | show_engines_stmt
2406 | show_errors_stmt
2407 | show_events_stmt
2408 | show_function_code_stmt
2409 | show_function_status_stmt
2410 | show_grants_stmt
2411 | show_keys_stmt
2412 | show_master_status_stmt
2413 | show_open_tables_stmt
2414 | show_plugins_stmt
2415 | show_privileges_stmt
2416 | show_procedure_code_stmt
2417 | show_procedure_status_stmt
2418 | show_processlist_stmt
2419 | show_profile_stmt
2420 | show_profiles_stmt
2421 | show_relaylog_events_stmt
2422 | show_replica_status_stmt
2423 | show_replicas_stmt
2424 | show_stats_stmt
2425 | show_status_stmt
2426 | show_table_status_stmt
2427 | show_tables_stmt
2428 | show_triggers_stmt
2429 | show_variables_stmt
2430 | show_warnings_stmt
2431 | shutdown_stmt
2432 14040 | signal_stmt { $$= nullptr; }
2433 4923 | start { $$= nullptr; }
2434 7504 | start_replica_stmt { $$= nullptr; }
2435 6284 | stop_replica_stmt { $$= nullptr; }
2436 | truncate_stmt
2437 1552 | uninstall { $$= nullptr; }
2438 4436 | unlock { $$= nullptr; }
2439 | update_stmt
2440 86576 | use { $$= nullptr; }
2441 3304 | xa { $$= nullptr; }
2442 ;
2443
2444 deallocate:
2445 deallocate_or_drop PREPARE_SYM ident
2446 {
2447 41417 THD *thd= YYTHD;
2448 41417 LEX *lex= thd->lex;
2449 41417 lex->sql_command= SQLCOM_DEALLOCATE_PREPARE;
2450 41417 lex->prepared_stmt_name= to_lex_cstring($3);
2451 }
2452 ;
2453
2454 deallocate_or_drop:
2455 DEALLOCATE_SYM
2456 | DROP
2457 ;
2458
2459 prepare:
2460 PREPARE_SYM ident FROM prepare_src
2461 {
2462 45662 THD *thd= YYTHD;
2463 45662 LEX *lex= thd->lex;
2464 45662 lex->sql_command= SQLCOM_PREPARE;
2465 45662 lex->prepared_stmt_name= to_lex_cstring($2);
2466 /*
2467 We don't know know at this time whether there's a password
2468 in prepare_src, so we err on the side of caution. Setting
2469 the flag will force a rewrite which will obscure all of
2470 prepare_src in the "Query" log line. We'll see the actual
2471 query (with just the passwords obscured, if any) immediately
2472 afterwards in the "Prepare" log lines anyway, and then again
2473 in the "Execute" log line if and when prepare_src is executed.
2474 */
2475 45662 lex->contains_plaintext_password= true;
2476 }
2477 ;
2478
2479 prepare_src:
2480 TEXT_STRING_sys
2481 {
2482 6238 THD *thd= YYTHD;
2483 6238 LEX *lex= thd->lex;
2484 6238 lex->prepared_stmt_code= $1;
2485 6238 lex->prepared_stmt_code_is_varref= false;
2486 }
2487 | '@' ident_or_text
2488 {
2489 39424 THD *thd= YYTHD;
2490 39424 LEX *lex= thd->lex;
2491 39424 lex->prepared_stmt_code= $2;
2492 39424 lex->prepared_stmt_code_is_varref= true;
2493 }
2494 ;
2495
2496 execute:
2497 EXECUTE_SYM ident
2498 {
2499 79671 THD *thd= YYTHD;
2500 79671 LEX *lex= thd->lex;
2501 79671 lex->sql_command= SQLCOM_EXECUTE;
2502 79671 lex->prepared_stmt_name= to_lex_cstring($2);
2503 }
2504 execute_using
2505 {}
2506 ;
2507
2508 execute_using:
2509 /* nothing */
2510 | USING execute_var_list
2511 ;
2512
2513 execute_var_list:
2514 execute_var_list ',' execute_var_ident
2515 | execute_var_ident
2516 ;
2517
2518 execute_var_ident:
2519 '@' ident_or_text
2520 {
2521 11352 LEX *lex=Lex;
2522
1/2
✓ Branch 0 taken 11352 times.
✗ Branch 1 not taken.
11352 LEX_STRING *lexstr= (LEX_STRING*)sql_memdup(&$2, sizeof(LEX_STRING));
2523
4/8
✓ Branch 0 taken 11352 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11352 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 11352 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 11352 times.
11352 if (!lexstr || lex->prepared_stmt_params.push_back(lexstr))
2524 MYSQL_YYABORT;
2525 }
2526 ;
2527
2528 /* help */
2529
2530 help:
2531 HELP_SYM
2532 {
2533
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 22 times.
25 if (Lex->sphead)
2534 {
2535
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 my_error(ER_SP_BADSTATEMENT, MYF(0), "HELP");
2536 3 MYSQL_YYABORT;
2537 }
2538 }
2539 ident_or_text
2540 {
2541 22 LEX *lex= Lex;
2542 22 lex->sql_command= SQLCOM_HELP;
2543 22 lex->help_arg= $3.str;
2544 }
2545 ;
2546
2547 /* change master */
2548
2549 change_replication_source:
2550 MASTER_SYM
2551 {
2552
1/2
✓ Branch 0 taken 11 times.
✗ Branch 1 not taken.
11 push_deprecated_warn(YYTHD, "CHANGE MASTER",
2553 "CHANGE REPLICATION SOURCE");
2554 }
2555 | REPLICATION SOURCE_SYM
2556 ;
2557
2558 change:
2559 CHANGE change_replication_source TO_SYM
2560 {
2561 8101 LEX *lex = Lex;
2562 8101 lex->sql_command = SQLCOM_CHANGE_MASTER;
2563 /*
2564 Clear LEX_MASTER_INFO struct. repl_ignore_server_ids is cleared
2565 in THD::cleanup_after_query. So it is guaranteed to be empty here.
2566 */
2567
2/4
✓ Branch 0 taken 8101 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8101 times.
8101 assert(Lex->mi.repl_ignore_server_ids.empty());
2568
1/2
✓ Branch 0 taken 8101 times.
✗ Branch 1 not taken.
8101 lex->mi.set_unspecified();
2569 }
2570 source_defs opt_channel
2571 {
2572
2/4
✓ Branch 0 taken 8059 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8059 times.
8059 if (Lex->set_channel_name($6))
2573 MYSQL_YYABORT; // OOM
2574 }
2575 | CHANGE REPLICATION FILTER_SYM
2576 {
2577 145 THD *thd= YYTHD;
2578 145 LEX* lex= thd->lex;
2579
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 145 times.
145 assert(!lex->m_sql_cmd);
2580 145 lex->sql_command = SQLCOM_CHANGE_REPLICATION_FILTER;
2581
1/2
✓ Branch 0 taken 145 times.
✗ Branch 1 not taken.
290 lex->m_sql_cmd= NEW_PTN Sql_cmd_change_repl_filter();
2582
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 145 times.
145 if (lex->m_sql_cmd == NULL)
2583 MYSQL_YYABORT;
2584 }
2585 filter_defs opt_channel
2586 {
2587
2/4
✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 140 times.
140 if (Lex->set_channel_name($6))
2588 MYSQL_YYABORT; // OOM
2589 }
2590 ;
2591
2592 filter_defs:
2593 filter_def
2594 | filter_defs ',' filter_def
2595 ;
2596 filter_def:
2597 REPLICATE_DO_DB EQ opt_filter_db_list
2598 {
2599 44 Sql_cmd_change_repl_filter * filter_sql_cmd=
2600 44 (Sql_cmd_change_repl_filter*) Lex->m_sql_cmd;
2601
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 44 times.
44 assert(filter_sql_cmd);
2602
1/2
✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
44 filter_sql_cmd->set_filter_value($3, OPT_REPLICATE_DO_DB);
2603 }
2604 | REPLICATE_IGNORE_DB EQ opt_filter_db_list
2605 {
2606 22 Sql_cmd_change_repl_filter * filter_sql_cmd=
2607 22 (Sql_cmd_change_repl_filter*) Lex->m_sql_cmd;
2608
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 22 times.
22 assert(filter_sql_cmd);
2609
1/2
✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
22 filter_sql_cmd->set_filter_value($3, OPT_REPLICATE_IGNORE_DB);
2610 }
2611 | REPLICATE_DO_TABLE EQ opt_filter_table_list
2612 {
2613 21 Sql_cmd_change_repl_filter * filter_sql_cmd=
2614 21 (Sql_cmd_change_repl_filter*) Lex->m_sql_cmd;
2615
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
21 assert(filter_sql_cmd);
2616
1/2
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
21 filter_sql_cmd->set_filter_value($3, OPT_REPLICATE_DO_TABLE);
2617 }
2618 | REPLICATE_IGNORE_TABLE EQ opt_filter_table_list
2619 {
2620 26 Sql_cmd_change_repl_filter * filter_sql_cmd=
2621 26 (Sql_cmd_change_repl_filter*) Lex->m_sql_cmd;
2622
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
26 assert(filter_sql_cmd);
2623
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
26 filter_sql_cmd->set_filter_value($3, OPT_REPLICATE_IGNORE_TABLE);
2624 }
2625 | REPLICATE_WILD_DO_TABLE EQ opt_filter_string_list
2626 {
2627 20 Sql_cmd_change_repl_filter * filter_sql_cmd=
2628 20 (Sql_cmd_change_repl_filter*) Lex->m_sql_cmd;
2629
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
20 assert(filter_sql_cmd);
2630
1/2
✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
20 filter_sql_cmd->set_filter_value($3, OPT_REPLICATE_WILD_DO_TABLE);
2631 }
2632 | REPLICATE_WILD_IGNORE_TABLE EQ opt_filter_string_list
2633 {
2634 16 Sql_cmd_change_repl_filter * filter_sql_cmd=
2635 16 (Sql_cmd_change_repl_filter*) Lex->m_sql_cmd;
2636
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
16 assert(filter_sql_cmd);
2637
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 filter_sql_cmd->set_filter_value($3,
2638 OPT_REPLICATE_WILD_IGNORE_TABLE);
2639 }
2640 | REPLICATE_REWRITE_DB EQ opt_filter_db_pair_list
2641 {
2642 23 Sql_cmd_change_repl_filter * filter_sql_cmd=
2643 23 (Sql_cmd_change_repl_filter*) Lex->m_sql_cmd;
2644
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 23 times.
23 assert(filter_sql_cmd);
2645
1/2
✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
23 filter_sql_cmd->set_filter_value($3, OPT_REPLICATE_REWRITE_DB);
2646 }
2647 ;
2648 opt_filter_db_list:
2649 '(' ')'
2650 {
2651
1/2
✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
20 $$= NEW_PTN mem_root_deque<Item *>(YYMEM_ROOT);
2652
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
20 if ($$ == NULL)
2653 MYSQL_YYABORT;
2654 }
2655 | '(' filter_db_list ')'
2656 {
2657 46 $$= $2;
2658 }
2659 ;
2660
2661 filter_db_list:
2662 filter_db_ident
2663 {
2664
1/2
✓ Branch 0 taken 46 times.
✗ Branch 1 not taken.
46 $$= NEW_PTN mem_root_deque<Item *>(YYMEM_ROOT);
2665
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 46 times.
46 if ($$ == NULL)
2666 MYSQL_YYABORT;
2667
1/2
✓ Branch 0 taken 46 times.
✗ Branch 1 not taken.
46 $$->push_back($1);
2668 }
2669 | filter_db_list ',' filter_db_ident
2670 {
2671
1/2
✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
33 $1->push_back($3);
2672 33 $$= $1;
2673 }
2674 ;
2675
2676 filter_db_ident:
2677 ident /* DB name */
2678 {
2679 111 THD *thd= YYTHD;
2680 111 Item *db_item= NEW_PTN Item_string($1.str, $1.length,
2681
2/4
✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 111 times.
✗ Branch 3 not taken.
111 thd->charset());
2682 111 $$= db_item;
2683 }
2684 ;
2685 opt_filter_db_pair_list:
2686 '(' ')'
2687 {
2688
1/2
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
9 $$= NEW_PTN mem_root_deque<Item *>(YYMEM_ROOT);
2689
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
9 if ($$ == NULL)
2690 MYSQL_YYABORT;
2691 }
2692 |'(' filter_db_pair_list ')'
2693 {
2694 14 $$= $2;
2695 }
2696 ;
2697 filter_db_pair_list:
2698 '(' filter_db_ident ',' filter_db_ident ')'
2699 {
2700
1/2
✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
14 $$= NEW_PTN mem_root_deque<Item *>(YYMEM_ROOT);
2701
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
14 if ($$ == NULL)
2702 MYSQL_YYABORT;
2703
1/2
✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
14 $$->push_back($2);
2704
1/2
✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
14 $$->push_back($4);
2705 }
2706 | filter_db_pair_list ',' '(' filter_db_ident ',' filter_db_ident ')'
2707 {
2708
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $1->push_back($4);
2709
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $1->push_back($6);
2710 2 $$= $1;
2711 }
2712 ;
2713 opt_filter_table_list:
2714 '(' ')'
2715 {
2716
1/2
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
18 $$= NEW_PTN mem_root_deque<Item *>(YYMEM_ROOT);
2717
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
18 if ($$ == NULL)
2718 MYSQL_YYABORT;
2719 }
2720 |'(' filter_table_list ')'
2721 {
2722 29 $$= $2;
2723 }
2724 ;
2725
2726 filter_table_list:
2727 filter_table_ident
2728 {
2729
1/2
✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
29 $$= NEW_PTN mem_root_deque<Item *>(YYMEM_ROOT);
2730
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 29 times.
29 if ($$ == NULL)
2731 MYSQL_YYABORT;
2732
1/2
✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
29 $$->push_back($1);
2733 }
2734 | filter_table_list ',' filter_table_ident
2735 {
2736
1/2
✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
14 $1->push_back($3);
2737 14 $$= $1;
2738 }
2739 ;
2740
2741 filter_table_ident:
2742 schema '.' ident /* qualified table name */
2743 {
2744 43 THD *thd= YYTHD;
2745 43 Item_string *table_item= NEW_PTN Item_string($1.str, $1.length,
2746
2/4
✓ Branch 0 taken 43 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 43 times.
✗ Branch 3 not taken.
43 thd->charset());
2747
2/4
✓ Branch 0 taken 43 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 43 times.
✗ Branch 3 not taken.
43 table_item->append(thd->strmake(".", 1), 1);
2748
1/2
✓ Branch 0 taken 43 times.
✗ Branch 1 not taken.
43 table_item->append($3.str, $3.length);
2749 43 $$= table_item;
2750 }
2751 ;
2752
2753 opt_filter_string_list:
2754 '(' ')'
2755 {
2756
1/2
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
13 $$= NEW_PTN mem_root_deque<Item *>(YYMEM_ROOT);
2757
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
13 if ($$ == NULL)
2758 MYSQL_YYABORT;
2759 }
2760 |'(' filter_string_list ')'
2761 {
2762 23 $$= $2;
2763 }
2764 ;
2765
2766 filter_string_list:
2767 filter_string
2768 {
2769
1/2
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
25 $$= NEW_PTN mem_root_deque<Item *>(YYMEM_ROOT);
2770
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 25 times.
25 if ($$ == NULL)
2771 MYSQL_YYABORT;
2772
1/2
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
25 $$->push_back($1);
2773 }
2774 | filter_string_list ',' filter_string
2775 {
2776
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 $1->push_back($3);
2777 4 $$= $1;
2778 }
2779 ;
2780
2781 filter_string:
2782 filter_wild_db_table_string
2783 {
2784 29 THD *thd= YYTHD;
2785 29 Item *string_item= NEW_PTN Item_string($1.str, $1.length,
2786
2/4
✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29 times.
✗ Branch 3 not taken.
29 thd->charset());
2787 29 $$= string_item;
2788 }
2789 ;
2790
2791 source_defs:
2792 source_def
2793 | source_defs ',' source_def
2794 ;
2795
2796 change_replication_source_auto_position:
2797 MASTER_AUTO_POSITION_SYM
2798 {
2799
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 push_deprecated_warn(YYTHD, "MASTER_AUTO_POSITION",
2800 "SOURCE_AUTO_POSITION");
2801
2802 }
2803 | SOURCE_AUTO_POSITION_SYM
2804 ;
2805
2806 change_replication_source_host:
2807 MASTER_HOST_SYM
2808 {
2809
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 push_deprecated_warn(YYTHD, "MASTER_HOST",
2810 "SOURCE_HOST");
2811 }
2812 | SOURCE_HOST_SYM
2813 ;
2814
2815 change_replication_source_bind:
2816 MASTER_BIND_SYM
2817 {
2818
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_BIND",
2819 "SOURCE_BIND");
2820
2821 }
2822 | SOURCE_BIND_SYM
2823 ;
2824
2825 change_replication_source_user:
2826 MASTER_USER_SYM
2827 {
2828
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 push_deprecated_warn(YYTHD, "MASTER_USER",
2829 "SOURCE_USER");
2830 }
2831 | SOURCE_USER_SYM
2832 ;
2833
2834 change_replication_source_password:
2835 MASTER_PASSWORD_SYM
2836 {
2837
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 push_deprecated_warn(YYTHD, "MASTER_PASSWORD",
2838 "SOURCE_PASSWORD");
2839 }
2840 | SOURCE_PASSWORD_SYM
2841 ;
2842
2843 change_replication_source_port:
2844 MASTER_PORT_SYM
2845 {
2846
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_PORT",
2847 "SOURCE_PORT");
2848 }
2849 | SOURCE_PORT_SYM
2850 ;
2851
2852 change_replication_source_connect_retry:
2853 MASTER_CONNECT_RETRY_SYM
2854 {
2855
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_CONNECT_RETRY",
2856 "SOURCE_CONNECT_RETRY");
2857 }
2858 | SOURCE_CONNECT_RETRY_SYM
2859 ;
2860
2861 change_replication_source_retry_count:
2862 MASTER_RETRY_COUNT_SYM
2863 {
2864
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_RETRY_COUNT",
2865 "SOURCE_RETRY_COUNT");
2866 }
2867 | SOURCE_RETRY_COUNT_SYM
2868 ;
2869
2870 change_replication_source_delay:
2871 MASTER_DELAY_SYM
2872 {
2873
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_DELAY",
2874 "SOURCE_DELAY");
2875 }
2876 | SOURCE_DELAY_SYM
2877 ;
2878
2879 change_replication_source_ssl:
2880 MASTER_SSL_SYM
2881 {
2882
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_SSL",
2883 "SOURCE_SSL");
2884 }
2885 | SOURCE_SSL_SYM
2886 ;
2887
2888 change_replication_source_ssl_ca:
2889 MASTER_SSL_CA_SYM
2890 {
2891
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_SSL_CA",
2892 "SOURCE_SSL_CA");
2893 }
2894 | SOURCE_SSL_CA_SYM
2895 ;
2896
2897 change_replication_source_ssl_capath:
2898 MASTER_SSL_CAPATH_SYM
2899 {
2900
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_SSL_CAPATH",
2901 "SOURCE_SSL_CAPATH");
2902 }
2903 | SOURCE_SSL_CAPATH_SYM
2904 ;
2905
2906 change_replication_source_ssl_cipher:
2907 MASTER_SSL_CIPHER_SYM
2908 {
2909
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_SSL_CIPHER",
2910 "SOURCE_SSL_CIPHER");
2911 }
2912 | SOURCE_SSL_CIPHER_SYM
2913 ;
2914
2915 change_replication_source_ssl_crl:
2916 MASTER_SSL_CRL_SYM
2917 {
2918
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_SSL_CRL",
2919 "SOURCE_SSL_CRL");
2920 }
2921 | SOURCE_SSL_CRL_SYM
2922 ;
2923
2924 change_replication_source_ssl_crlpath:
2925 MASTER_SSL_CRLPATH_SYM
2926 {
2927
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_SSL_CRLPATH",
2928 "SOURCE_SSL_CRLPATH");
2929 }
2930 | SOURCE_SSL_CRLPATH_SYM
2931 ;
2932
2933 change_replication_source_ssl_key:
2934 MASTER_SSL_KEY_SYM
2935 {
2936
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_SSL_KEY",
2937 "SOURCE_SSL_KEY");
2938 }
2939 | SOURCE_SSL_KEY_SYM
2940 ;
2941
2942 change_replication_source_ssl_verify_server_cert:
2943 MASTER_SSL_VERIFY_SERVER_CERT_SYM
2944 {
2945
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_SSL_VERIFY_SERVER_CERT",
2946 "SOURCE_SSL_VERIFY_SERVER_CERT");
2947 }
2948 | SOURCE_SSL_VERIFY_SERVER_CERT_SYM
2949 ;
2950
2951 change_replication_source_tls_version:
2952 MASTER_TLS_VERSION_SYM
2953 {
2954
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_TLS_VERSION",
2955 "SOURCE_TLS_VERSION");
2956 }
2957 | SOURCE_TLS_VERSION_SYM
2958 ;
2959
2960 change_replication_source_tls_ciphersuites:
2961 MASTER_TLS_CIPHERSUITES_SYM
2962 {
2963
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_TLS_CIPHERSUITES",
2964 "SOURCE_TLS_CIPHERSUITES");
2965 }
2966 | SOURCE_TLS_CIPHERSUITES_SYM
2967 ;
2968
2969 change_replication_source_ssl_cert:
2970 MASTER_SSL_CERT_SYM
2971 {
2972
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_SSL_CERT",
2973 "SOURCE_SSL_CERT");
2974 }
2975 | SOURCE_SSL_CERT_SYM
2976 ;
2977
2978 change_replication_source_public_key:
2979 MASTER_PUBLIC_KEY_PATH_SYM
2980 {
2981
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_PUBLIC_KEY_PATH",
2982 "SOURCE_PUBLIC_KEY_PATH");
2983 }
2984 | SOURCE_PUBLIC_KEY_PATH_SYM
2985 ;
2986
2987 change_replication_source_get_source_public_key:
2988 GET_MASTER_PUBLIC_KEY_SYM
2989 {
2990
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "GET_MASTER_PUBLIC_KEY",
2991 "GET_SOURCE_PUBLIC_KEY");
2992 }
2993 | GET_SOURCE_PUBLIC_KEY_SYM
2994 ;
2995
2996 change_replication_source_heartbeat_period:
2997 MASTER_HEARTBEAT_PERIOD_SYM
2998 {
2999
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_HEARTBEAT_PERIOD",
3000 "SOURCE_HEARTBEAT_PERIOD");
3001 }
3002 | SOURCE_HEARTBEAT_PERIOD_SYM
3003 ;
3004
3005 change_replication_source_compression_algorithm:
3006 MASTER_COMPRESSION_ALGORITHM_SYM
3007 {
3008
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_COMPRESSION_ALGORITHM",
3009 "SOURCE_COMPRESSION_ALGORITHM");
3010 }
3011 | SOURCE_COMPRESSION_ALGORITHM_SYM
3012 ;
3013
3014 change_replication_source_zstd_compression_level:
3015 MASTER_ZSTD_COMPRESSION_LEVEL_SYM
3016 {
3017
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 push_deprecated_warn(YYTHD, "MASTER_ZSTD_COMPRESSION_LEVEL",
3018 "SOURCE_ZSTD_COMPRESSION_LEVEL");
3019 }
3020 | SOURCE_ZSTD_COMPRESSION_LEVEL_SYM
3021 ;
3022
3023 source_def:
3024 change_replication_source_host EQ TEXT_STRING_sys_nonewline
3025 {
3026 3919 Lex->mi.host = $3.str;
3027 }
3028 | NETWORK_NAMESPACE_SYM EQ TEXT_STRING_sys_nonewline
3029 {
3030 3 Lex->mi.network_namespace = $3.str;
3031 }
3032 | change_replication_source_bind EQ TEXT_STRING_sys_nonewline
3033 {
3034 24 Lex->mi.bind_addr = $3.str;
3035 }
3036 | change_replication_source_user EQ TEXT_STRING_sys_nonewline
3037 {
3038 5686 Lex->mi.user = $3.str;
3039 }
3040 | change_replication_source_password EQ TEXT_STRING_sys_nonewline
3041 {
3042 202 Lex->mi.password = $3.str;
3043
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 201 times.
202 if (strlen($3.str) > 32)
3044 {
3045
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_CHANGE_MASTER_PASSWORD_LENGTH, MYF(0));
3046 1 MYSQL_YYABORT;
3047 }
3048 201 Lex->contains_plaintext_password= true;
3049 }
3050 | change_replication_source_port EQ ulong_num
3051 {
3052 3736 Lex->mi.port = $3;
3053 }
3054 | change_replication_source_connect_retry EQ ulong_num
3055 {
3056 3209 Lex->mi.connect_retry = $3;
3057 }
3058 | change_replication_source_retry_count EQ ulong_num
3059 {
3060 239 Lex->mi.retry_count= $3;
3061 239 Lex->mi.retry_count_opt= LEX_MASTER_INFO::LEX_MI_ENABLE;
3062 }
3063 | change_replication_source_delay EQ ulong_num
3064 {
3065
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 100 times.
101 if ($3 > MASTER_DELAY_MAX)
3066 {
3067
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 const char *msg= YYTHD->strmake(@3.cpp.start, @3.cpp.end - @3.cpp.start);
3068
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_MASTER_DELAY_VALUE_OUT_OF_RANGE, MYF(0),
3069 msg, MASTER_DELAY_MAX);
3070 }
3071 else
3072 100 Lex->mi.sql_delay = $3;
3073 }
3074 | change_replication_source_ssl EQ ulong_num
3075 {
3076
2/2
✓ Branch 0 taken 41 times.
✓ Branch 1 taken 44 times.
85 Lex->mi.ssl= $3 ?
3077 LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE;
3078 }
3079 | change_replication_source_ssl_ca EQ TEXT_STRING_sys_nonewline
3080 {
3081 34 Lex->mi.ssl_ca= $3.str;
3082 }
3083 | change_replication_source_ssl_capath EQ TEXT_STRING_sys_nonewline
3084 {
3085 3 Lex->mi.ssl_capath= $3.str;
3086 }
3087 | change_replication_source_tls_version EQ TEXT_STRING_sys_nonewline
3088 {
3089 9 Lex->mi.tls_version= $3.str;
3090 }
3091 | change_replication_source_tls_ciphersuites EQ source_tls_ciphersuites_def
3092 | change_replication_source_ssl_cert EQ TEXT_STRING_sys_nonewline
3093 {
3094 34 Lex->mi.ssl_cert= $3.str;
3095 }
3096 | change_replication_source_ssl_cipher EQ TEXT_STRING_sys_nonewline
3097 {
3098 3 Lex->mi.ssl_cipher= $3.str;
3099 }
3100 | change_replication_source_ssl_key EQ TEXT_STRING_sys_nonewline
3101 {
3102 34 Lex->mi.ssl_key= $3.str;
3103 }
3104 | change_replication_source_ssl_verify_server_cert EQ ulong_num
3105 {
3106
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 4 times.
14 Lex->mi.ssl_verify_server_cert= $3 ?
3107 LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE;
3108 }
3109 | change_replication_source_ssl_crl EQ TEXT_STRING_sys_nonewline
3110 {
3111 14 Lex->mi.ssl_crl= $3.str;
3112 }
3113 | change_replication_source_ssl_crlpath EQ TEXT_STRING_sys_nonewline
3114 {
3115 14 Lex->mi.ssl_crlpath= $3.str;
3116 }
3117 | change_replication_source_public_key EQ TEXT_STRING_sys_nonewline
3118 {
3119 17 Lex->mi.public_key_path= $3.str;
3120 }
3121 | change_replication_source_get_source_public_key EQ ulong_num
3122 {
3123
2/2
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 12 times.
32 Lex->mi.get_public_key= $3 ?
3124 LEX_MASTER_INFO::LEX_MI_ENABLE :
3125 LEX_MASTER_INFO::LEX_MI_DISABLE;
3126 }
3127 | change_replication_source_heartbeat_period EQ NUM_literal
3128 {
3129 91 Item *num= $3;
3130
7/14
✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 91 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 91 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 91 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 91 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 91 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 91 times.
91 ITEMIZE(num, &num);
3131
3132
1/2
✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
91 Lex->mi.heartbeat_period= (float) num->val_real();
3133
2/2
✓ Branch 0 taken 85 times.
✓ Branch 1 taken 6 times.
91 if (Lex->mi.heartbeat_period > SLAVE_MAX_HEARTBEAT_PERIOD ||
3134
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 85 times.
85 Lex->mi.heartbeat_period < 0.0)
3135 {
3136 6 const char format[]= "%d";
3137 char buf[4*sizeof(SLAVE_MAX_HEARTBEAT_PERIOD) + sizeof(format)];
3138 6 sprintf(buf, format, SLAVE_MAX_HEARTBEAT_PERIOD);
3139
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 my_error(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE, MYF(0), buf);
3140 6 MYSQL_YYABORT;
3141 }
3142
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 77 times.
85 if (Lex->mi.heartbeat_period > replica_net_timeout)
3143 {
3144
2/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
8 push_warning(YYTHD, Sql_condition::SL_WARNING,
3145 ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX,
3146 ER_THD(YYTHD, ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX));
3147 }
3148
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 80 times.
85 if (Lex->mi.heartbeat_period < 0.001)
3149 {
3150
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 if (Lex->mi.heartbeat_period != 0.0)
3151 {
3152
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 push_warning(YYTHD, Sql_condition::SL_WARNING,
3153 ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN,
3154 ER_THD(YYTHD, ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN));
3155 4 Lex->mi.heartbeat_period= 0.0;
3156 }
3157 5 Lex->mi.heartbeat_opt= LEX_MASTER_INFO::LEX_MI_DISABLE;
3158 }
3159 85 Lex->mi.heartbeat_opt= LEX_MASTER_INFO::LEX_MI_ENABLE;
3160 }
3161 | IGNORE_SERVER_IDS_SYM EQ '(' ignore_server_id_list ')'
3162 {
3163 42 Lex->mi.repl_ignore_server_ids_opt= LEX_MASTER_INFO::LEX_MI_ENABLE;
3164 }
3165 | change_replication_source_compression_algorithm EQ TEXT_STRING_sys
3166 {
3167 164 Lex->mi.compression_algorithm = $3.str;
3168 }
3169 | change_replication_source_zstd_compression_level EQ ulong_num
3170 {
3171 142 Lex->mi.zstd_compression_level = $3;
3172 }
3173 | change_replication_source_auto_position EQ ulong_num
3174 {
3175
2/2
✓ Branch 0 taken 1298 times.
✓ Branch 1 taken 3002 times.
4300 Lex->mi.auto_position= $3 ?
3176 LEX_MASTER_INFO::LEX_MI_ENABLE :
3177 LEX_MASTER_INFO::LEX_MI_DISABLE;
3178 }
3179 | PRIVILEGE_CHECKS_USER_SYM EQ privilege_check_def
3180 | REQUIRE_ROW_FORMAT_SYM EQ ulong_num
3181 {
3182
3/3
✓ Branch 0 taken 2980 times.
✓ Branch 1 taken 51 times.
✓ Branch 2 taken 1 times.
3032 switch($3) {
3183 2980 case 0:
3184 2980 Lex->mi.require_row_format =
3185 LEX_MASTER_INFO::LEX_MI_DISABLE;
3186 2980 break;
3187 51 case 1:
3188 51 Lex->mi.require_row_format =
3189 LEX_MASTER_INFO::LEX_MI_ENABLE;
3190 51 break;
3191 1 default:
3192
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 const char* wrong_value = YYTHD->strmake(@3.raw.start, @3.raw.length());
3193
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_REQUIRE_ROW_FORMAT_INVALID_VALUE, MYF(0), wrong_value);
3194 }
3195 }
3196 | REQUIRE_TABLE_PRIMARY_KEY_CHECK_SYM EQ table_primary_key_check_def
3197 | SOURCE_CONNECTION_AUTO_FAILOVER_SYM EQ real_ulong_num
3198 {
3199
2/3
✓ Branch 0 taken 19 times.
✓ Branch 1 taken 94 times.
✗ Branch 2 not taken.
113 switch($3) {
3200 19 case 0:
3201 19 Lex->mi.m_source_connection_auto_failover =
3202 LEX_MASTER_INFO::LEX_MI_DISABLE;
3203 19 break;
3204 94 case 1:
3205 94 Lex->mi.m_source_connection_auto_failover =
3206 LEX_MASTER_INFO::LEX_MI_ENABLE;
3207 94 break;
3208 default:
3209 YYTHD->syntax_error_at(@3);
3210 MYSQL_YYABORT;
3211 }
3212 }
3213 | ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS_SYM EQ assign_gtids_to_anonymous_transactions_def
3214 | GTID_ONLY_SYM EQ real_ulong_num
3215 {
3216
3/3
✓ Branch 0 taken 2955 times.
✓ Branch 1 taken 22 times.
✓ Branch 2 taken 1 times.
2978 switch($3) {
3217 2955 case 0:
3218 2955 Lex->mi.m_gtid_only =
3219 LEX_MASTER_INFO::LEX_MI_DISABLE;
3220 2955 break;
3221 22 case 1:
3222 22 Lex->mi.m_gtid_only =
3223 LEX_MASTER_INFO::LEX_MI_ENABLE;
3224 22 break;
3225 1 default:
3226
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 YYTHD->syntax_error_at(@3,
3227 "You have an error in your CHANGE REPLICATION SOURCE syntax; GTID_ONLY only accepts values 0 or 1");
3228 1 MYSQL_YYABORT;
3229 }
3230 }
3231 | source_file_def
3232 ;
3233
3234 ignore_server_id_list:
3235 /* Empty */
3236 | ignore_server_id
3237 | ignore_server_id_list ',' ignore_server_id
3238 ;
3239
3240 ignore_server_id:
3241 ulong_num
3242 {
3243
1/2
✓ Branch 0 taken 92 times.
✗ Branch 1 not taken.
92 Lex->mi.repl_ignore_server_ids.push_back($1);
3244 }
3245
3246 privilege_check_def:
3247 user_ident_or_text
3248 {
3249 43 Lex->mi.privilege_checks_none= false;
3250 43 Lex->mi.privilege_checks_username= $1->user.str;
3251 43 Lex->mi.privilege_checks_hostname= $1->host.str;
3252 }
3253 | NULL_SYM
3254 {
3255 2965 Lex->mi.privilege_checks_none= true;
3256 2965 Lex->mi.privilege_checks_username= NULL;
3257 2965 Lex->mi.privilege_checks_hostname= NULL;
3258 }
3259 ;
3260
3261 table_primary_key_check_def:
3262 STREAM_SYM
3263 {
3264 5 Lex->mi.require_table_primary_key_check= LEX_MASTER_INFO::LEX_MI_PK_CHECK_STREAM;
3265 }
3266 | ON_SYM
3267 {
3268 8 Lex->mi.require_table_primary_key_check= LEX_MASTER_INFO::LEX_MI_PK_CHECK_ON;
3269 }
3270 | OFF_SYM
3271 {
3272 15 Lex->mi.require_table_primary_key_check= LEX_MASTER_INFO::LEX_MI_PK_CHECK_OFF;
3273 }
3274 ;
3275
3276 assign_gtids_to_anonymous_transactions_def:
3277 OFF_SYM
3278 {
3279 11 Lex->mi.assign_gtids_to_anonymous_transactions_type = LEX_MASTER_INFO::LEX_MI_ANONYMOUS_TO_GTID_OFF;
3280 }
3281 | LOCAL_SYM
3282 {
3283 17 Lex->mi.assign_gtids_to_anonymous_transactions_type = LEX_MASTER_INFO::LEX_MI_ANONYMOUS_TO_GTID_LOCAL;
3284 }
3285 | TEXT_STRING
3286 {
3287 10 Lex->mi.assign_gtids_to_anonymous_transactions_type = LEX_MASTER_INFO::LEX_MI_ANONYMOUS_TO_GTID_UUID;
3288 10 Lex->mi.assign_gtids_to_anonymous_transactions_manual_uuid = $1.str;
3289
3/4
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 9 times.
10 if (!binary_log::Uuid::is_valid($1.str, binary_log::Uuid::TEXT_LENGTH))
3290 {
3291
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_WRONG_VALUE, MYF(0), "UUID", $1.str);
3292 1 MYSQL_YYABORT;
3293 }
3294 }
3295 ;
3296
3297
3298 source_tls_ciphersuites_def:
3299 TEXT_STRING_sys_nonewline
3300 {
3301 13 Lex->mi.tls_ciphersuites = LEX_MASTER_INFO::SPECIFIED_STRING;
3302 13 Lex->mi.tls_ciphersuites_string= $1.str;
3303 }
3304 | NULL_SYM
3305 {
3306 4 Lex->mi.tls_ciphersuites = LEX_MASTER_INFO::SPECIFIED_NULL;
3307 4 Lex->mi.tls_ciphersuites_string = NULL;
3308 }
3309 ;
3310
3311 source_log_file:
3312 MASTER_LOG_FILE_SYM
3313 {
3314
1/2
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
8 push_deprecated_warn(YYTHD, "MASTER_LOG_FILE",
3315 "SOURCE_LOG_FILE");
3316 }
3317 | SOURCE_LOG_FILE_SYM
3318 ;
3319
3320 source_log_pos:
3321 MASTER_LOG_POS_SYM
3322 {
3323
1/2
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
8 push_deprecated_warn(YYTHD, "MASTER_LOG_POS",
3324 "SOURCE_LOG_POS");
3325 }
3326 | SOURCE_LOG_POS_SYM
3327 ;
3328
3329 source_file_def:
3330 source_log_file EQ TEXT_STRING_sys_nonewline
3331 {
3332 137 Lex->mi.log_file_name = $3.str;
3333 }
3334 | source_log_pos EQ ulonglong_num
3335 {
3336 149 Lex->mi.pos = $3;
3337 /*
3338 If the user specified a value < BIN_LOG_HEADER_SIZE, adjust it
3339 instead of causing subsequent errors.
3340 We need to do it in this file, because only there we know that
3341 MASTER_LOG_POS has been explicitely specified. On the contrary
3342 in change_master() (sql_repl.cc) we cannot distinguish between 0
3343 (MASTER_LOG_POS explicitely specified as 0) and 0 (unspecified),
3344 whereas we want to distinguish (specified 0 means "read the binlog
3345 from 0" (4 in fact), unspecified means "don't change the position
3346 (keep the preceding value)").
3347 */
3348 149 Lex->mi.pos = max<ulonglong>(BIN_LOG_HEADER_SIZE, Lex->mi.pos);
3349 }
3350 | RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys_nonewline
3351 {
3352 91 Lex->mi.relay_log_name = $3.str;
3353 }
3354 | RELAY_LOG_POS_SYM EQ ulong_num
3355 {
3356 74 Lex->mi.relay_log_pos = $3;
3357 /* Adjust if < BIN_LOG_HEADER_SIZE (same comment as Lex->mi.pos) */
3358 74 Lex->mi.relay_log_pos = max<ulong>(BIN_LOG_HEADER_SIZE,
3359 74 Lex->mi.relay_log_pos);
3360 }
3361 ;
3362
3363 opt_channel:
3364 /*empty */
3365 205147 { $$ = {}; }
3366 | FOR_SYM CHANNEL_SYM TEXT_STRING_sys_nonewline
3367 23259 { $$ = to_lex_cstring($3); }
3368 ;
3369
3370 create_table_stmt:
3371 CREATE opt_temporary TABLE_SYM opt_if_not_exists table_ident
3372 '(' table_element_list ')' opt_create_table_options_etc
3373 {
3374
1/2
✓ Branch 0 taken 667340 times.
✗ Branch 1 not taken.
1334680 $$= NEW_PTN PT_create_table_stmt(YYMEM_ROOT, $1, $2, $4, $5,
3375 667340 $7,
3376 667340 $9.opt_create_table_options,
3377 $9.opt_partitioning,
3378 $9.on_duplicate,
3379
1/2
✓ Branch 0 taken 667340 times.
✗ Branch 1 not taken.
1334678 $9.opt_query_expression);
3380 }
3381 | CREATE opt_temporary TABLE_SYM opt_if_not_exists table_ident
3382 opt_create_table_options_etc
3383 {
3384
1/2
✓ Branch 0 taken 7785 times.
✗ Branch 1 not taken.
15570 $$= NEW_PTN PT_create_table_stmt(YYMEM_ROOT, $1, $2, $4, $5,
3385 NULL,
3386 7785 $6.opt_create_table_options,
3387 $6.opt_partitioning,
3388 $6.on_duplicate,
3389
1/2
✓ Branch 0 taken 7785 times.
✗ Branch 1 not taken.
15570 $6.opt_query_expression);
3390 }
3391 | CREATE opt_temporary TABLE_SYM opt_if_not_exists table_ident
3392 LIKE table_ident
3393 {
3394
2/4
✓ Branch 0 taken 3597 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3597 times.
✗ Branch 3 not taken.
3597 $$= NEW_PTN PT_create_table_stmt(YYMEM_ROOT, $1, $2, $4, $5, $7);
3395 }
3396 | CREATE opt_temporary TABLE_SYM opt_if_not_exists table_ident
3397 '(' LIKE table_ident ')'
3398 {
3399
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 $$= NEW_PTN PT_create_table_stmt(YYMEM_ROOT, $1, $2, $4, $5, $8);
3400 }
3401 ;
3402
3403 create_role_stmt:
3404 CREATE ROLE_SYM opt_if_not_exists role_list
3405 {
3406
1/2
✓ Branch 0 taken 554 times.
✗ Branch 1 not taken.
554 $$= NEW_PTN PT_create_role(!!$3, $4);
3407 }
3408 ;
3409
3410 create_resource_group_stmt:
3411 CREATE RESOURCE_SYM GROUP_SYM ident TYPE_SYM
3412 opt_equal resource_group_types
3413 opt_resource_group_vcpu_list opt_resource_group_priority
3414 opt_resource_group_enable_disable
3415 {
3416
1/2
✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
72 $$= NEW_PTN PT_create_resource_group(to_lex_cstring($4), $7, $8, $9,
3417 24 $10.is_default ? true :
3418
1/2
✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
48 $10.value);
3419 }
3420 ;
3421
3422 create:
3423 CREATE DATABASE opt_if_not_exists ident
3424 {
3425
1/2
✓ Branch 0 taken 18631 times.
✗ Branch 1 not taken.
18631 Lex->create_info= YYTHD->alloc_typed<HA_CREATE_INFO>();
3426
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 18631 times.
18631 if (Lex->create_info == NULL)
3427 MYSQL_YYABORT; // OOM
3428 18631 Lex->create_info->default_table_charset= NULL;
3429 18631 Lex->create_info->used_fields= 0;
3430 }
3431 opt_create_database_options
3432 {
3433 18621 LEX *lex=Lex;
3434 18621 lex->sql_command=SQLCOM_CREATE_DB;
3435 18621 lex->name= $4;
3436
2/2
✓ Branch 0 taken 829 times.
✓ Branch 1 taken 17792 times.
18621 lex->create_info->options= $3 ? HA_LEX_CREATE_IF_NOT_EXISTS : 0;
3437 }
3438 | CREATE view_or_trigger_or_sp_or_event
3439 {}
3440 | CREATE USER opt_if_not_exists create_user_list default_role_clause
3441 require_clause connect_options
3442 opt_account_lock_password_expire_options
3443 opt_user_attribute
3444 {
3445 6195 LEX *lex=Lex;
3446 6195 lex->sql_command = SQLCOM_CREATE_USER;
3447 6195 lex->default_roles= $5;
3448
1/2
✓ Branch 0 taken 6195 times.
✗ Branch 1 not taken.
6195 Lex->create_info= YYTHD->alloc_typed<HA_CREATE_INFO>();
3449
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6195 times.
6195 if (Lex->create_info == NULL)
3450 MYSQL_YYABORT; // OOM
3451
2/2
✓ Branch 0 taken 298 times.
✓ Branch 1 taken 5897 times.
6195 lex->create_info->options= $3 ? HA_LEX_CREATE_IF_NOT_EXISTS : 0;
3452 }
3453 | CREATE LOGFILE_SYM GROUP_SYM ident ADD lg_undofile
3454 opt_logfile_group_options
3455 {
3456
2/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
5 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
3457
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if (pc == NULL)
3458 MYSQL_YYABORT; /* purecov: inspected */ // OOM
3459
3460
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2 times.
5 if ($7 != NULL)
3461 {
3462
5/10
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 3 times.
3 if (YYTHD->is_error() || contextualize_array(pc, $7))
3463 MYSQL_YYABORT; /* purecov: inspected */
3464 }
3465
3466
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
10 Lex->m_sql_cmd= NEW_PTN Sql_cmd_logfile_group{CREATE_LOGFILE_GROUP,
3467
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
10 $4, pc, $6};
3468
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if (!Lex->m_sql_cmd)
3469 MYSQL_YYABORT; /* purecov: inspected */ //OOM
3470
3471 5 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
3472 }
3473 | CREATE TABLESPACE_SYM ident opt_ts_datafile_name
3474 opt_logfile_group_name opt_tablespace_options
3475 {
3476
2/4
✓ Branch 0 taken 1051 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1051 times.
✗ Branch 3 not taken.
1051 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
3477
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1051 times.
1051 if (pc == NULL)
3478 MYSQL_YYABORT; /* purecov: inspected */ // OOM
3479
3480
2/2
✓ Branch 0 taken 766 times.
✓ Branch 1 taken 285 times.
1051 if ($6 != NULL)
3481 {
3482
7/10
✓ Branch 0 taken 766 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 766 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 766 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 765 times.
✓ Branch 8 taken 1 times.
✓ Branch 9 taken 765 times.
766 if (YYTHD->is_error() || contextualize_array(pc, $6))
3483 1 MYSQL_YYABORT;
3484 }
3485
3486
2/4
✓ Branch 0 taken 1050 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1050 times.
✗ Branch 3 not taken.
1050 auto cmd= NEW_PTN Sql_cmd_create_tablespace{$3, $4, $5, pc};
3487
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1050 times.
1050 if (!cmd)
3488 MYSQL_YYABORT; /* purecov: inspected */ //OOM
3489 1050 Lex->m_sql_cmd= cmd;
3490 1050 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
3491 }
3492 | CREATE UNDO_SYM TABLESPACE_SYM ident ADD ts_datafile
3493 opt_undo_tablespace_options
3494 {
3495
2/4
✓ Branch 0 taken 386 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 386 times.
✗ Branch 3 not taken.
386 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
3496
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 386 times.
386 if (pc == NULL)
3497 MYSQL_YYABORT; // OOM
3498
3499
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 384 times.
386 if ($7 != NULL)
3500 {
3501
5/10
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
2 if (YYTHD->is_error() || contextualize_array(pc, $7))
3502 MYSQL_YYABORT;
3503 }
3504
3505 auto cmd= NEW_PTN Sql_cmd_create_undo_tablespace{
3506
2/4
✓ Branch 0 taken 386 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 386 times.
✗ Branch 3 not taken.
386 CREATE_UNDO_TABLESPACE, $4, $6, pc};
3507
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 386 times.
386 if (!cmd)
3508 MYSQL_YYABORT; //OOM
3509 386 Lex->m_sql_cmd= cmd;
3510 386 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
3511 }
3512 | CREATE SERVER_SYM ident_or_text FOREIGN DATA_SYM WRAPPER_SYM
3513 ident_or_text OPTIONS_SYM '(' server_options_list ')'
3514 {
3515 34 Lex->sql_command= SQLCOM_CREATE_SERVER;
3516
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 33 times.
34 if ($3.length == 0)
3517 {
3518
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_WRONG_VALUE, MYF(0), "server name", "");
3519 1 MYSQL_YYABORT;
3520 }
3521 33 Lex->server_options.m_server_name= $3;
3522 33 Lex->server_options.set_scheme($7);
3523 33 Lex->m_sql_cmd=
3524
1/2
✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
33 NEW_PTN Sql_cmd_create_server(&Lex->server_options);
3525 }
3526 | CREATE COMPRESSION_DICTIONARY_SYM opt_if_not_exists ident
3527 '(' create_compression_dictionary_allowed_expr ')'
3528 {
3529 76 Lex->sql_command= SQLCOM_CREATE_COMPRESSION_DICTIONARY;
3530
1/2
✓ Branch 0 taken 76 times.
✗ Branch 1 not taken.
76 Lex->create_info= YYTHD->alloc_typed<HA_CREATE_INFO>();
3531
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 76 times.
76 if (Lex->create_info == nullptr)
3532 MYSQL_YYABORT; // OOM
3533
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 66 times.
76 Lex->create_info->options= $3 ? HA_LEX_CREATE_IF_NOT_EXISTS : 0;
3534 76 Lex->ident= $4;
3535 76 Lex->create_info->zip_dict_name = $6;
3536 }
3537 ;
3538
3539 create_srs_stmt:
3540 CREATE OR_SYM REPLACE_SYM SPATIAL_SYM REFERENCE_SYM SYSTEM_SYM
3541 real_ulonglong_num srs_attributes
3542 {
3543
2/4
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48 times.
✗ Branch 3 not taken.
48 $$= NEW_PTN PT_create_srs($7, *$8, true, false);
3544 }
3545 | CREATE SPATIAL_SYM REFERENCE_SYM SYSTEM_SYM opt_if_not_exists
3546 real_ulonglong_num srs_attributes
3547 {
3548
2/4
✓ Branch 0 taken 472 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 472 times.
✗ Branch 3 not taken.
472 $$= NEW_PTN PT_create_srs($6, *$7, false, $5);
3549 }
3550 ;
3551
3552 srs_attributes:
3553 /* empty */
3554 {
3555
1/2
✓ Branch 0 taken 525 times.
✗ Branch 1 not taken.
1050 $$ = NEW_PTN Sql_cmd_srs_attributes();
3556
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 525 times.
525 if (!$$)
3557 MYSQL_YYABORT_ERROR(ER_DA_OOM, MYF(0)); /* purecov: inspected */
3558 }
3559 | srs_attributes NAME_SYM TEXT_STRING_sys_nonewline
3560 {
3561
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 524 times.
525 if ($1->srs_name.str != nullptr)
3562 {
3563
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 MYSQL_YYABORT_ERROR(ER_SRS_MULTIPLE_ATTRIBUTE_DEFINITIONS, MYF(0),
3564 "NAME");
3565 }
3566 else
3567 {
3568 524 $1->srs_name= $3;
3569 }
3570 }
3571 | srs_attributes DEFINITION_SYM TEXT_STRING_sys_nonewline
3572 {
3573
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 521 times.
522 if ($1->definition.str != nullptr)
3574 {
3575
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 MYSQL_YYABORT_ERROR(ER_SRS_MULTIPLE_ATTRIBUTE_DEFINITIONS, MYF(0),
3576 "DEFINITION");
3577 }
3578 else
3579 {
3580 521 $1->definition= $3;
3581 }
3582 }
3583 | srs_attributes ORGANIZATION_SYM TEXT_STRING_sys_nonewline
3584 IDENTIFIED_SYM BY real_ulonglong_num
3585 {
3586
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 30 times.
31 if ($1->organization.str != nullptr)
3587 {
3588
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 MYSQL_YYABORT_ERROR(ER_SRS_MULTIPLE_ATTRIBUTE_DEFINITIONS, MYF(0),
3589 "ORGANIZATION");
3590 }
3591 else
3592 {
3593 30 $1->organization= $3;
3594 30 $1->organization_coordsys_id= $6;
3595 }
3596 }
3597 | srs_attributes DESCRIPTION_SYM TEXT_STRING_sys_nonewline
3598 {
3599
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 4 times.
5 if ($1->description.str != nullptr)
3600 {
3601
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 MYSQL_YYABORT_ERROR(ER_SRS_MULTIPLE_ATTRIBUTE_DEFINITIONS, MYF(0),
3602 "DESCRIPTION");
3603 }
3604 else
3605 {
3606 4 $1->description= $3;
3607 }
3608 }
3609 ;
3610
3611 default_role_clause:
3612 /* empty */
3613 {
3614 6180 $$= 0;
3615 }
3616 |
3617 DEFAULT_SYM ROLE_SYM role_list
3618 {
3619 27 $$= $3;
3620 }
3621 ;
3622
3623 create_index_stmt:
3624 CREATE opt_unique_combo_clustering INDEX_SYM ident opt_index_type_clause
3625 ON_SYM table_ident '(' key_list_with_expression ')' opt_index_options
3626 opt_index_lock_and_algorithm
3627 {
3628
1/2
✓ Branch 0 taken 4418 times.
✗ Branch 1 not taken.
8836 $$= NEW_PTN PT_create_index_stmt(YYMEM_ROOT, $2, $4, $5,
3629 4418 $7, $9, $11,
3630
1/2
✓ Branch 0 taken 4418 times.
✗ Branch 1 not taken.
4418 $12.algo.get_or_default(),
3631
2/4
✓ Branch 0 taken 4418 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4418 times.
✗ Branch 3 not taken.
8836 $12.lock.get_or_default());
3632 }
3633 | CREATE FULLTEXT_SYM INDEX_SYM ident ON_SYM table_ident
3634 '(' key_list_with_expression ')' opt_fulltext_index_options opt_index_lock_and_algorithm
3635 {
3636
1/2
✓ Branch 0 taken 90 times.
✗ Branch 1 not taken.
180 $$= NEW_PTN PT_create_index_stmt(YYMEM_ROOT, KEYTYPE_FULLTEXT, $4,
3637 90 NULL, $6, $8, $10,
3638
1/2
✓ Branch 0 taken 90 times.
✗ Branch 1 not taken.
90 $11.algo.get_or_default(),
3639
2/4
✓ Branch 0 taken 90 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 90 times.
✗ Branch 3 not taken.
180 $11.lock.get_or_default());
3640 }
3641 | CREATE SPATIAL_SYM INDEX_SYM ident ON_SYM table_ident
3642 '(' key_list_with_expression ')' opt_spatial_index_options opt_index_lock_and_algorithm
3643 {
3644
1/2
✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
128 $$= NEW_PTN PT_create_index_stmt(YYMEM_ROOT, KEYTYPE_SPATIAL, $4,
3645 64 NULL, $6, $8, $10,
3646
1/2
✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
64 $11.algo.get_or_default(),
3647
2/4
✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 64 times.
✗ Branch 3 not taken.
128 $11.lock.get_or_default());
3648 }
3649 ;
3650 /*
3651 Only a limited subset of <expr> are allowed in
3652 CREATE COMPRESSION_DICTIONARY.
3653 */
3654 create_compression_dictionary_allowed_expr:
3655 text_literal
3656
7/14
✓ Branch 0 taken 51 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 51 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 51 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 51 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 51 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 51 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 51 times.
51 { ITEMIZE($1, &$$); }
3657 | rvalue_system_or_user_variable
3658
7/14
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 25 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 25 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 25 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 25 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 25 times.
25 { ITEMIZE($1, &$$); }
3659 ;
3660
3661 server_options_list:
3662 server_option
3663 | server_options_list ',' server_option
3664 ;
3665
3666 server_option:
3667 USER TEXT_STRING_sys
3668 {
3669 35 Lex->server_options.set_username($2);
3670 }
3671 | HOST_SYM TEXT_STRING_sys
3672 {
3673 32 Lex->server_options.set_host($2);
3674 }
3675 | DATABASE TEXT_STRING_sys
3676 {
3677 35 Lex->server_options.set_db($2);
3678 }
3679 | OWNER_SYM TEXT_STRING_sys
3680 {
3681 9 Lex->server_options.set_owner($2);
3682 }
3683 | PASSWORD TEXT_STRING_sys
3684 {
3685 13 Lex->server_options.set_password($2);
3686 13 Lex->contains_plaintext_password= true;
3687 }
3688 | SOCKET_SYM TEXT_STRING_sys
3689 {
3690 9 Lex->server_options.set_socket($2);
3691 }
3692 | PORT_SYM ulong_num
3693 {
3694 17 Lex->server_options.set_port($2);
3695 }
3696 ;
3697
3698 event_tail:
3699 EVENT_SYM opt_if_not_exists sp_name
3700 {
3701 961 THD *thd= YYTHD;
3702 961 LEX *lex=Lex;
3703
3704 961 lex->stmt_definition_begin= @1.cpp.start;
3705
2/2
✓ Branch 0 taken 29 times.
✓ Branch 1 taken 932 times.
961 lex->create_info->options= $2 ? HA_LEX_CREATE_IF_NOT_EXISTS : 0;
3706
2/4
✓ Branch 0 taken 961 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 961 times.
1922 if (!(lex->event_parse_data= new (thd->mem_root) Event_parse_data()))
3707 MYSQL_YYABORT;
3708 961 lex->event_parse_data->identifier= $3;
3709 961 lex->event_parse_data->on_completion=
3710 Event_parse_data::ON_COMPLETION_DROP;
3711
3712 961 lex->sql_command= SQLCOM_CREATE_EVENT;
3713 /* We need that for disallowing subqueries */
3714 }
3715 ON_SYM SCHEDULE_SYM ev_schedule_time
3716 opt_ev_on_completion
3717 opt_ev_status
3718 opt_ev_comment
3719 DO_SYM ev_sql_stmt
3720 {
3721 /*
3722 sql_command is set here because some rules in ev_sql_stmt
3723 can overwrite it
3724 */
3725 950 Lex->sql_command= SQLCOM_CREATE_EVENT;
3726 }
3727 ;
3728
3729 ev_schedule_time:
3730 EVERY_SYM expr interval
3731 {
3732
7/14
✓ Branch 0 taken 855 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 855 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 855 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 855 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 855 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 855 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 855 times.
855 ITEMIZE($2, &$2);
3733
3734 855 Lex->event_parse_data->item_expression= $2;
3735 855 Lex->event_parse_data->interval= $3;
3736 }
3737 ev_starts
3738 ev_ends
3739 | AT_SYM expr
3740 {
3741
7/14
✓ Branch 0 taken 184 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 184 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 184 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 184 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 184 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 184 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 184 times.
184 ITEMIZE($2, &$2);
3742
3743 184 Lex->event_parse_data->item_execute_at= $2;
3744 }
3745 ;
3746
3747 opt_ev_status:
3748 947 /* empty */ { $$= 0; }
3749 | ENABLE_SYM
3750 {
3751 109 Lex->event_parse_data->status= Event_parse_data::ENABLED;
3752 109 Lex->event_parse_data->status_changed= true;
3753 109 $$= 1;
3754 }
3755 | DISABLE_SYM ON_SYM SLAVE
3756 {
3757 9 Lex->event_parse_data->status= Event_parse_data::SLAVESIDE_DISABLED;
3758 9 Lex->event_parse_data->status_changed= true;
3759 9 $$= 1;
3760 }
3761 | DISABLE_SYM
3762 {
3763 125 Lex->event_parse_data->status= Event_parse_data::DISABLED;
3764 125 Lex->event_parse_data->status_changed= true;
3765 125 $$= 1;
3766 }
3767 ;
3768
3769 ev_starts:
3770 /* empty */
3771 {
3772
2/4
✓ Branch 0 taken 697 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 697 times.
✗ Branch 3 not taken.
697 Item *item= NEW_PTN Item_func_now_local(0);
3773
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 697 times.
697 if (item == NULL)
3774 MYSQL_YYABORT;
3775 697 Lex->event_parse_data->item_starts= item;
3776 }
3777 | STARTS_SYM expr
3778 {
3779
7/14
✓ Branch 0 taken 158 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 158 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 158 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 158 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 158 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 158 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 158 times.
158 ITEMIZE($2, &$2);
3780
3781 158 Lex->event_parse_data->item_starts= $2;
3782 }
3783 ;
3784
3785 ev_ends:
3786 /* empty */
3787 | ENDS_SYM expr
3788 {
3789
7/14
✓ Branch 0 taken 76 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 76 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 76 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 76 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 76 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 76 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 76 times.
76 ITEMIZE($2, &$2);
3790
3791 76 Lex->event_parse_data->item_ends= $2;
3792 }
3793 ;
3794
3795 opt_ev_on_completion:
3796 797 /* empty */ { $$= 0; }
3797 | ev_on_completion
3798 ;
3799
3800 ev_on_completion:
3801 ON_SYM COMPLETION_SYM PRESERVE_SYM
3802 {
3803 78 Lex->event_parse_data->on_completion=
3804 Event_parse_data::ON_COMPLETION_PRESERVE;
3805 78 $$= 1;
3806 }
3807 | ON_SYM COMPLETION_SYM NOT_SYM PRESERVE_SYM
3808 {
3809 96 Lex->event_parse_data->on_completion=
3810 Event_parse_data::ON_COMPLETION_DROP;
3811 96 $$= 1;
3812 }
3813 ;
3814
3815 opt_ev_comment:
3816 1142 /* empty */ { $$= 0; }
3817 | COMMENT_SYM TEXT_STRING_sys
3818 {
3819 48 Lex->event_parse_data->comment= $2;
3820 48 $$= 1;
3821 }
3822 ;
3823
3824 ev_sql_stmt:
3825 {
3826 982 THD *thd= YYTHD;
3827 982 LEX *lex= thd->lex;
3828
3829 /*
3830 This stops the following :
3831 - CREATE EVENT ... DO CREATE EVENT ...;
3832 - ALTER EVENT ... DO CREATE EVENT ...;
3833 - CREATE EVENT ... DO ALTER EVENT DO ....;
3834 - CREATE PROCEDURE ... BEGIN CREATE EVENT ... END|
3835 This allows:
3836 - CREATE EVENT ... DO DROP EVENT yyy;
3837 - CREATE EVENT ... DO ALTER EVENT yyy;
3838 (the nested ALTER EVENT can have anything but DO clause)
3839 - ALTER EVENT ... DO ALTER EVENT yyy;
3840 (the nested ALTER EVENT can have anything but DO clause)
3841 - ALTER EVENT ... DO DROP EVENT yyy;
3842 - CREATE PROCEDURE ... BEGIN ALTER EVENT ... END|
3843 (the nested ALTER EVENT can have anything but DO clause)
3844 - CREATE PROCEDURE ... BEGIN DROP EVENT ... END|
3845 */
3846
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 977 times.
982 if (lex->sphead)
3847 {
3848
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 my_error(ER_EVENT_RECURSION_FORBIDDEN, MYF(0));
3849 5 MYSQL_YYABORT;
3850 }
3851
3852 1954 sp_head *sp= sp_start_parsing(thd,
3853 enum_sp_type::EVENT,
3854
1/2
✓ Branch 0 taken 977 times.
✗ Branch 1 not taken.
977 lex->event_parse_data->identifier);
3855
3856
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 977 times.
977 if (!sp)
3857 MYSQL_YYABORT;
3858
3859 977 lex->sphead= sp;
3860
3861 977 memset(&lex->sp_chistics, 0, sizeof(st_sp_chistics));
3862 977 sp->m_chistics= &lex->sp_chistics;
3863
3864 /*
3865 Set a body start to the end of the last preprocessed token
3866 before ev_sql_stmt:
3867 */
3868
1/2
✓ Branch 0 taken 977 times.
✗ Branch 1 not taken.
977 sp->set_body_start(thd, @0.cpp.end);
3869 }
3870 ev_sql_stmt_inner
3871 {
3872 976 THD *thd= YYTHD;
3873 976 LEX *lex= thd->lex;
3874
3875
1/2
✓ Branch 0 taken 976 times.
✗ Branch 1 not taken.
976 sp_finish_parsing(thd);
3876
3877 976 lex->sp_chistics.suid= SP_IS_SUID; //always the definer!
3878 976 lex->event_parse_data->body_changed= true;
3879 }
3880 ;
3881
3882 ev_sql_stmt_inner:
3883 sp_proc_stmt_statement
3884 | sp_proc_stmt_return
3885 | sp_proc_stmt_if
3886 | case_stmt_specification
3887 | sp_labeled_block
3888 | sp_unlabeled_block
3889 | sp_labeled_control
3890 | sp_proc_stmt_unlabeled
3891 | sp_proc_stmt_leave
3892 | sp_proc_stmt_iterate
3893 | sp_proc_stmt_open
3894 | sp_proc_stmt_fetch
3895 | sp_proc_stmt_close
3896 ;
3897
3898 sp_name:
3899 ident '.' ident
3900 {
3901
3/4
✓ Branch 0 taken 95036 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 95034 times.
190073 if (!$1.str ||
3902
3/4
✓ Branch 0 taken 95037 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 95034 times.
95036 (check_and_convert_db_name(&$1, false) != Ident_name_check::OK))
3903 3 MYSQL_YYABORT;
3904
3/4
✓ Branch 0 taken 95033 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 95032 times.
95034 if (sp_check_name(&$3))
3905 {
3906 1 MYSQL_YYABORT;
3907 }
3908
1/2
✓ Branch 0 taken 95033 times.
✗ Branch 1 not taken.
95032 $$= new (YYMEM_ROOT) sp_name(to_lex_cstring($1), $3, true);
3909
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 95032 times.
95032 if ($$ == NULL)
3910 MYSQL_YYABORT;
3911
1/2
✓ Branch 0 taken 95033 times.
✗ Branch 1 not taken.
95032 $$->init_qname(YYTHD);
3912 }
3913 | ident
3914 {
3915 435130 THD *thd= YYTHD;
3916 435130 LEX *lex= thd->lex;
3917 LEX_CSTRING db;
3918
3/4
✓ Branch 0 taken 435131 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 30 times.
✓ Branch 3 taken 435101 times.
435130 if (sp_check_name(&$1))
3919 {
3920 41 MYSQL_YYABORT;
3921 }
3922
3/4
✓ Branch 0 taken 435103 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11 times.
✓ Branch 3 taken 435092 times.
435101 if (lex->copy_db_to(&db.str, &db.length))
3923 11 MYSQL_YYABORT;
3924
1/2
✓ Branch 0 taken 435091 times.
✗ Branch 1 not taken.
435092 $$= new (YYMEM_ROOT) sp_name(db, $1, false);
3925
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 435091 times.
435091 if ($$ == NULL)
3926 MYSQL_YYABORT;
3927
1/2
✓ Branch 0 taken 435092 times.
✗ Branch 1 not taken.
435091 $$->init_qname(thd);
3928 }
3929 ;
3930
3931 sp_a_chistics:
3932 /* Empty */ {}
3933 | sp_a_chistics sp_chistic {}
3934 ;
3935
3936 sp_c_chistics:
3937 /* Empty */ {}
3938 | sp_c_chistics sp_c_chistic {}
3939 ;
3940
3941 /* Characteristics for both create and alter */
3942 sp_chistic:
3943 COMMENT_SYM TEXT_STRING_sys
3944 87058 { Lex->sp_chistics.comment= to_lex_cstring($2); }
3945 | LANGUAGE_SYM SQL_SYM
3946 { /* Just parse it, we only have one language for now. */ }
3947 | NO_SYM SQL_SYM
3948 51178 { Lex->sp_chistics.daccess= SP_NO_SQL; }
3949 | CONTAINS_SYM SQL_SYM
3950 1855 { Lex->sp_chistics.daccess= SP_CONTAINS_SQL; }
3951 | READS_SYM SQL_SYM DATA_SYM
3952 24575 { Lex->sp_chistics.daccess= SP_READS_SQL_DATA; }
3953 | MODIFIES_SYM SQL_SYM DATA_SYM
3954 9041 { Lex->sp_chistics.daccess= SP_MODIFIES_SQL_DATA; }
3955 | sp_suid
3956 {}
3957 ;
3958
3959 /* Create characteristics */
3960 sp_c_chistic:
3961 sp_chistic { }
3962 69370 | DETERMINISTIC_SYM { Lex->sp_chistics.detistic= true; }
3963 12478 | not DETERMINISTIC_SYM { Lex->sp_chistics.detistic= false; }
3964 ;
3965
3966 sp_suid:
3967 SQL_SYM SECURITY_SYM DEFINER_SYM
3968 {
3969 180 Lex->sp_chistics.suid= SP_IS_SUID;
3970 }
3971 | SQL_SYM SECURITY_SYM INVOKER_SYM
3972 {
3973 88232 Lex->sp_chistics.suid= SP_IS_NOT_SUID;
3974 }
3975 ;
3976
3977 call_stmt:
3978 CALL_SYM sp_name opt_paren_expr_list
3979 {
3980
1/2
✓ Branch 0 taken 193940 times.
✗ Branch 1 not taken.
193940 $$= NEW_PTN PT_call($1, $2, $3);
3981 }
3982 ;
3983
3984 opt_paren_expr_list:
3985 216 /* Empty */ { $$= NULL; }
3986 | '(' opt_expr_list ')'
3987 {
3988 193724 $$= $2;
3989 }
3990 ;
3991
3992 /* Stored FUNCTION parameter declaration list */
3993 sp_fdparam_list:
3994 /* Empty */
3995 | sp_fdparams
3996 ;
3997
3998 sp_fdparams:
3999 sp_fdparams ',' sp_fdparam
4000 | sp_fdparam
4001 ;
4002
4003 sp_fdparam:
4004 ident type opt_collate
4005 {
4006 107578 THD *thd= YYTHD;
4007 107578 LEX *lex= thd->lex;
4008
4009
7/14
✓ Branch 0 taken 107578 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 107578 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 107578 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 107578 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 107578 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 107578 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 107578 times.
107578 CONTEXTUALIZE($2);
4010 107578 enum_field_types field_type= $2->type;
4011
1/2
✓ Branch 0 taken 107578 times.
✗ Branch 1 not taken.
107578 const CHARSET_INFO *cs= $2->get_charset();
4012
3/4
✓ Branch 0 taken 107578 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 107577 times.
107578 if (merge_sp_var_charset_and_collation(cs, $3, &cs))
4013 1 MYSQL_YYABORT;
4014
4015 107577 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4016
4017
3/4
✓ Branch 0 taken 107577 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 107576 times.
107577 if (sp_check_name(&$1))
4018 1 MYSQL_YYABORT;
4019
4020
3/4
✓ Branch 0 taken 107576 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 107575 times.
107576 if (pctx->find_variable($1.str, $1.length, true))
4021 {
4022
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_SP_DUP_PARAM, MYF(0), $1.str);
4023 1 MYSQL_YYABORT;
4024 }
4025
4026 215150 sp_variable *spvar= pctx->add_variable(thd,
4027
1/2
✓ Branch 0 taken 107575 times.
✗ Branch 1 not taken.
107575 $1,
4028 field_type,
4029 sp_variable::MODE_IN);
4030
4031
3/4
✓ Branch 0 taken 107575 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 107574 times.
322725 if (spvar->field_def.init(thd, "", field_type,
4032
1/2
✓ Branch 0 taken 107575 times.
✗ Branch 1 not taken.
107575 $2->get_length(), $2->get_dec(),
4033
2/4
✓ Branch 0 taken 107575 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 107575 times.
✗ Branch 3 not taken.
107575 $2->get_type_flags(),
4034 NULL, NULL, &NULL_CSTR, 0,
4035
1/2
✓ Branch 0 taken 107575 times.
✗ Branch 1 not taken.
107575 $2->get_interval_list(),
4036 107575 cs ? cs : thd->variables.collation_database,
4037
3/4
✓ Branch 0 taken 107575 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 33258 times.
✓ Branch 3 taken 74317 times.
107575 $3 != nullptr, $2->get_uint_geom_type(), nullptr,
4038 nullptr, nullptr, {},
4039 dd::Column::enum_hidden_type::HT_VISIBLE))
4040 {
4041 1 MYSQL_YYABORT;
4042 }
4043
4044
2/4
✓ Branch 0 taken 107574 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 107574 times.
107574 if (prepare_sp_create_field(thd,
4045 &spvar->field_def))
4046 {
4047 MYSQL_YYABORT;
4048 }
4049 107574 spvar->field_def.field_name= spvar->name.str;
4050 107574 spvar->field_def.is_nullable= true;
4051 }
4052 ;
4053
4054 /* Stored PROCEDURE parameter declaration list */
4055 sp_pdparam_list:
4056 /* Empty */
4057 | sp_pdparams
4058 ;
4059
4060 sp_pdparams:
4061 sp_pdparams ',' sp_pdparam
4062 | sp_pdparam
4063 ;
4064
4065 sp_pdparam:
4066 sp_opt_inout ident type opt_collate
4067 {
4068 51458 THD *thd= YYTHD;
4069 51458 LEX *lex= thd->lex;
4070 51458 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4071
4072
3/4
✓ Branch 0 taken 51459 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 51458 times.
51457 if (sp_check_name(&$2))
4073 4 MYSQL_YYABORT;
4074
4075
3/4
✓ Branch 0 taken 51458 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 51457 times.
51458 if (pctx->find_variable($2.str, $2.length, true))
4076 {
4077
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_SP_DUP_PARAM, MYF(0), $2.str);
4078 1 MYSQL_YYABORT;
4079 }
4080
4081
7/14
✓ Branch 0 taken 51456 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 51457 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 51457 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 51457 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 51457 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 51457 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 51457 times.
51457 CONTEXTUALIZE($3);
4082 51457 enum_field_types field_type= $3->type;
4083
1/2
✓ Branch 0 taken 51457 times.
✗ Branch 1 not taken.
51457 const CHARSET_INFO *cs= $3->get_charset();
4084
2/4
✓ Branch 0 taken 51457 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 51457 times.
51457 if (merge_sp_var_charset_and_collation(cs, $4, &cs))
4085 MYSQL_YYABORT;
4086
4087 102912 sp_variable *spvar= pctx->add_variable(thd,
4088 51457 $2,
4089 field_type,
4090
1/2
✓ Branch 0 taken 51455 times.
✗ Branch 1 not taken.
51457 (sp_variable::enum_mode) $1);
4091
4092
3/4
✓ Branch 0 taken 51457 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 51455 times.
154366 if (spvar->field_def.init(thd, "", field_type,
4093
1/2
✓ Branch 0 taken 51455 times.
✗ Branch 1 not taken.
51455 $3->get_length(), $3->get_dec(),
4094
2/4
✓ Branch 0 taken 51455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 51455 times.
✗ Branch 3 not taken.
51455 $3->get_type_flags(),
4095 NULL, NULL, &NULL_CSTR, 0,
4096
1/2
✓ Branch 0 taken 51455 times.
✗ Branch 1 not taken.
51456 $3->get_interval_list(),
4097 51456 cs ? cs : thd->variables.collation_database,
4098
3/4
✓ Branch 0 taken 51456 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 46824 times.
✓ Branch 3 taken 4632 times.
51455 $4 != nullptr, $3->get_uint_geom_type(), nullptr,
4099 nullptr, nullptr, {},
4100 dd::Column::enum_hidden_type::HT_VISIBLE))
4101 {
4102 2 MYSQL_YYABORT;
4103 }
4104
4105
2/4
✓ Branch 0 taken 51455 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 51455 times.
51455 if (prepare_sp_create_field(thd,
4106 &spvar->field_def))
4107 {
4108 MYSQL_YYABORT;
4109 }
4110 51455 spvar->field_def.field_name= spvar->name.str;
4111 51455 spvar->field_def.is_nullable= true;
4112 }
4113 ;
4114
4115 sp_opt_inout:
4116 2697 /* Empty */ { $$= sp_variable::MODE_IN; }
4117 31703 | IN_SYM { $$= sp_variable::MODE_IN; }
4118 15982 | OUT_SYM { $$= sp_variable::MODE_OUT; }
4119 1078 | INOUT_SYM { $$= sp_variable::MODE_INOUT; }
4120 ;
4121
4122 sp_proc_stmts:
4123 /* Empty */ {}
4124 | sp_proc_stmts sp_proc_stmt ';'
4125 ;
4126
4127 sp_proc_stmts1:
4128 sp_proc_stmt ';' {}
4129 | sp_proc_stmts1 sp_proc_stmt ';'
4130 ;
4131
4132 sp_decls:
4133 /* Empty */
4134 {
4135 376835 $$.vars= $$.conds= $$.hndlrs= $$.curs= 0;
4136 }
4137 | sp_decls sp_decl ';'
4138 {
4139 /* We check for declarations out of (standard) order this way
4140 because letting the grammar rules reflect it caused tricky
4141 shift/reduce conflicts with the wrong result. (And we get
4142 better error handling this way.) */
4143
8/8
✓ Branch 0 taken 43744 times.
✓ Branch 1 taken 110742 times.
✓ Branch 2 taken 1595 times.
✓ Branch 3 taken 42149 times.
✓ Branch 4 taken 112331 times.
✓ Branch 5 taken 6 times.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 112329 times.
154486 if (($2.vars || $2.conds) && ($1.curs || $1.hndlrs))
4144 { /* Variable or condition following cursor or handler */
4145
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
8 my_error(ER_SP_VARCOND_AFTER_CURSHNDLR, MYF(0));
4146 5 MYSQL_YYABORT;
4147 }
4148
4/4
✓ Branch 0 taken 5373 times.
✓ Branch 1 taken 149105 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 5371 times.
154478 if ($2.curs && $1.hndlrs)
4149 { /* Cursor following handler */
4150
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_CURSOR_AFTER_HANDLER, MYF(0));
4151 2 MYSQL_YYABORT;
4152 }
4153 154476 $$.vars= $1.vars + $2.vars;
4154 154476 $$.conds= $1.conds + $2.conds;
4155 154476 $$.hndlrs= $1.hndlrs + $2.hndlrs;
4156 154476 $$.curs= $1.curs + $2.curs;
4157 }
4158 ;
4159
4160 sp_decl:
4161 DECLARE_SYM /*$1*/
4162 sp_decl_idents /*$2*/
4163 type /*$3*/
4164 opt_collate /*$4*/
4165 sp_opt_default /*$5*/
4166 { /*$6*/
4167 110739 THD *thd= YYTHD;
4168 110739 LEX *lex= thd->lex;
4169 110739 sp_head *sp= lex->sphead;
4170 110739 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4171
4172
1/2
✓ Branch 0 taken 110744 times.
✗ Branch 1 not taken.
110741 sp->reset_lex(thd);
4173 110744 lex= thd->lex;
4174
4175 110744 pctx->declare_var_boundary($2);
4176
4177
8/14
✓ Branch 0 taken 110746 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 110746 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 110746 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 110745 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 110746 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 110746 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 110747 times.
110745 CONTEXTUALIZE($3);
4178 110747 enum enum_field_types var_type= $3->type;
4179
1/2
✓ Branch 0 taken 110746 times.
✗ Branch 1 not taken.
110747 const CHARSET_INFO *cs= $3->get_charset();
4180
3/4
✓ Branch 0 taken 110744 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 110743 times.
110746 if (merge_sp_var_charset_and_collation(cs, $4, &cs))
4181 1 MYSQL_YYABORT;
4182
4183
1/2
✓ Branch 0 taken 110744 times.
✗ Branch 1 not taken.
110743 uint num_vars= pctx->context_var_count();
4184 110744 Item *dflt_value_item= $5.expr;
4185
4186 110744 LEX_CSTRING dflt_value_query= EMPTY_CSTR;
4187
4188
2/2
✓ Branch 0 taken 42766 times.
✓ Branch 1 taken 67978 times.
110744 if (dflt_value_item)
4189 {
4190
7/14
✓ Branch 0 taken 42767 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 42766 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 42766 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 42767 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 42766 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 42766 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 42765 times.
42766 ITEMIZE(dflt_value_item, &dflt_value_item);
4191 42765 const char *expr_start_ptr= $5.expr_start;
4192
2/2
✓ Branch 0 taken 4495 times.
✓ Branch 1 taken 38272 times.
42765 if (lex->is_metadata_used())
4193 {
4194
1/2
✓ Branch 0 taken 4494 times.
✗ Branch 1 not taken.
4495 dflt_value_query= make_string(thd, expr_start_ptr,
4195 @5.raw.end);
4196
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4494 times.
4494 if (!dflt_value_query.str)
4197 MYSQL_YYABORT;
4198 }
4199 }
4200 else
4201 {
4202
1/2
✓ Branch 0 taken 67977 times.
✗ Branch 1 not taken.
135955 dflt_value_item= NEW_PTN Item_null();
4203
4204
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 67977 times.
67977 if (dflt_value_item == NULL)
4205 MYSQL_YYABORT;
4206 }
4207
4208 // We can have several variables in DECLARE statement.
4209 // We need to create an sp_instr_set instruction for each variable.
4210
4211
2/2
✓ Branch 0 taken 125207 times.
✓ Branch 1 taken 110742 times.
235949 for (uint i = num_vars-$2 ; i < num_vars ; i++)
4212 {
4213 125207 uint var_idx= pctx->var_context2runtime(i);
4214
1/2
✓ Branch 0 taken 125209 times.
✗ Branch 1 not taken.
125209 sp_variable *spvar= pctx->find_variable(var_idx);
4215
4216
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 125209 times.
125209 if (!spvar)
4217 MYSQL_YYABORT;
4218
4219 125209 spvar->type= var_type;
4220 125209 spvar->default_value= dflt_value_item;
4221
4222
3/4
✓ Branch 0 taken 125209 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 125208 times.
375627 if (spvar->field_def.init(thd, "", var_type,
4223
1/2
✓ Branch 0 taken 125209 times.
✗ Branch 1 not taken.
125207 $3->get_length(), $3->get_dec(),
4224
2/4
✓ Branch 0 taken 125208 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 125207 times.
✗ Branch 3 not taken.
125208 $3->get_type_flags(),
4225 NULL, NULL, &NULL_CSTR, 0,
4226
1/2
✓ Branch 0 taken 125208 times.
✗ Branch 1 not taken.
125209 $3->get_interval_list(),
4227 125209 cs ? cs : thd->variables.collation_database,
4228
3/4
✓ Branch 0 taken 125209 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 120857 times.
✓ Branch 3 taken 4352 times.
125209 $4 != nullptr, $3->get_uint_geom_type(), nullptr,
4229 nullptr, nullptr, {},
4230 dd::Column::enum_hidden_type::HT_VISIBLE))
4231 {
4232 1 MYSQL_YYABORT;
4233 }
4234
4235
2/4
✓ Branch 0 taken 125208 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 125208 times.
125208 if (prepare_sp_create_field(thd, &spvar->field_def))
4236 MYSQL_YYABORT;
4237
4238 125208 spvar->field_def.field_name= spvar->name.str;
4239 125208 spvar->field_def.is_nullable= true;
4240
4241 /* The last instruction is responsible for freeing LEX. */
4242
4243
1/2
✓ Branch 0 taken 125209 times.
✗ Branch 1 not taken.
125208 sp_instr_set *is= NEW_PTN sp_instr_set(sp->instructions(),
4244 lex,
4245 var_idx,
4246 dflt_value_item,
4247 dflt_value_query,
4248
2/4
✓ Branch 0 taken 125206 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 125209 times.
✗ Branch 3 not taken.
125209 (i == num_vars - 1));
4249
4250
4/8
✓ Branch 0 taken 125209 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 125206 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 125206 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 125206 times.
125209 if (!is || sp->add_instr(thd, is))
4251 MYSQL_YYABORT;
4252 }
4253
4254 110742 pctx->declare_var_boundary(0);
4255
2/4
✓ Branch 0 taken 110741 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 110741 times.
110741 if (sp->restore_lex(thd))
4256 MYSQL_YYABORT;
4257 110741 $$.vars= $2;
4258 110741 $$.conds= $$.hndlrs= $$.curs= 0;
4259 }
4260 | DECLARE_SYM ident CONDITION_SYM FOR_SYM sp_cond
4261 {
4262 1598 THD *thd= YYTHD;
4263 1598 LEX *lex= thd->lex;
4264 1598 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4265
4266
3/4
✓ Branch 0 taken 1598 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 1595 times.
1598 if (pctx->find_condition($2, true))
4267 {
4268
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 my_error(ER_SP_DUP_COND, MYF(0), $2.str);
4269 3 MYSQL_YYABORT;
4270 }
4271
2/4
✓ Branch 0 taken 1595 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1595 times.
1595 if(pctx->add_condition(thd, $2, $5))
4272 MYSQL_YYABORT;
4273 1595 lex->keep_diagnostics= DA_KEEP_DIAGNOSTICS; // DECLARE COND FOR
4274 1595 $$.vars= $$.hndlrs= $$.curs= 0;
4275 1595 $$.conds= 1;
4276 }
4277 | DECLARE_SYM sp_handler_type HANDLER_SYM FOR_SYM
4278 {
4279 36813 THD *thd= YYTHD;
4280 36813 LEX *lex= thd->lex;
4281 36813 sp_head *sp= lex->sphead;
4282
4283 36813 sp_pcontext *parent_pctx= lex->get_sp_current_parsing_ctx();
4284
4285 sp_pcontext *handler_pctx=
4286
1/2
✓ Branch 0 taken 36813 times.
✗ Branch 1 not taken.
36813 parent_pctx->push_context(thd, sp_pcontext::HANDLER_SCOPE);
4287
4288 sp_handler *h=
4289
1/2
✓ Branch 0 taken 36813 times.
✗ Branch 1 not taken.
36813 parent_pctx->add_handler(thd, (sp_handler::enum_type) $2);
4290
4291 36813 lex->set_sp_current_parsing_ctx(handler_pctx);
4292
4293 sp_instr_hpush_jump *i=
4294
3/6
✓ Branch 0 taken 36813 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 36813 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 36813 times.
✗ Branch 5 not taken.
36813 NEW_PTN sp_instr_hpush_jump(sp->instructions(), handler_pctx, h);
4295
4296
4/8
✓ Branch 0 taken 36813 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 36813 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 36813 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 36813 times.
36813 if (!i || sp->add_instr(thd, i))
4297 MYSQL_YYABORT;
4298
4299
2/2
✓ Branch 0 taken 35280 times.
✓ Branch 1 taken 1533 times.
36813 if ($2 == sp_handler::CONTINUE)
4300 {
4301 // Mark the end of CONTINUE handler scope.
4302
4303
4/8
✓ Branch 0 taken 35280 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35280 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 35280 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 35280 times.
35280 if (sp->m_parser_data.add_backpatch_entry(
4304 i, handler_pctx->last_label()))
4305 {
4306 MYSQL_YYABORT;
4307 }
4308 }
4309
4310
4/8
✓ Branch 0 taken 36813 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 36813 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 36813 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 36813 times.
36813 if (sp->m_parser_data.add_backpatch_entry(
4311 i, handler_pctx->push_label(thd, EMPTY_CSTR, 0)))
4312 {
4313 MYSQL_YYABORT;
4314 }
4315
4316 36813 lex->keep_diagnostics= DA_KEEP_DIAGNOSTICS; // DECL HANDLER FOR
4317 }
4318 sp_hcond_list sp_proc_stmt
4319 {
4320 36776 THD *thd= YYTHD;
4321 36776 LEX *lex= Lex;
4322 36776 sp_head *sp= lex->sphead;
4323 36776 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4324
1/2
✓ Branch 0 taken 36776 times.
✗ Branch 1 not taken.
36776 sp_label *hlab= pctx->pop_label(); /* After this hdlr */
4325
4326
2/2
✓ Branch 0 taken 35249 times.
✓ Branch 1 taken 1527 times.
36776 if ($2 == sp_handler::CONTINUE)
4327 {
4328 sp_instr_hreturn *i=
4329
3/6
✓ Branch 0 taken 35249 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35249 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 35249 times.
✗ Branch 5 not taken.
35249 NEW_PTN sp_instr_hreturn(sp->instructions(), pctx);
4330
4331
4/8
✓ Branch 0 taken 35249 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35249 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 35249 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 35249 times.
35249 if (!i || sp->add_instr(thd, i))
4332 MYSQL_YYABORT;
4333 }
4334 else
4335 { /* EXIT or UNDO handler, just jump to the end of the block */
4336 sp_instr_hreturn *i=
4337
3/6
✓ Branch 0 taken 1527 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1527 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1527 times.
✗ Branch 5 not taken.
1527 NEW_PTN sp_instr_hreturn(sp->instructions(), pctx);
4338
4339 3054 if (i == NULL ||
4340
4/8
✓ Branch 0 taken 1527 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1527 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1527 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1527 times.
3054 sp->add_instr(thd, i) ||
4341
4/8
✓ Branch 0 taken 1527 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1527 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1527 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1527 times.
1527 sp->m_parser_data.add_backpatch_entry(i, pctx->last_label()))
4342 MYSQL_YYABORT;
4343 }
4344
4345
2/4
✓ Branch 0 taken 36776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 36776 times.
✗ Branch 3 not taken.
36776 sp->m_parser_data.do_backpatch(hlab, sp->instructions());
4346
4347
1/2
✓ Branch 0 taken 36776 times.
✗ Branch 1 not taken.
36776 lex->set_sp_current_parsing_ctx(pctx->pop_context());
4348
4349 36776 $$.vars= $$.conds= $$.curs= 0;
4350 36776 $$.hndlrs= 1;
4351 }
4352 | DECLARE_SYM /*$1*/
4353 ident /*$2*/
4354 CURSOR_SYM /*$3*/
4355 FOR_SYM /*$4*/
4356 { /*$5*/
4357 5379 THD *thd= YYTHD;
4358 5379 LEX *lex= Lex;
4359 5379 sp_head *sp= lex->sphead;
4360
4361
1/2
✓ Branch 0 taken 5379 times.
✗ Branch 1 not taken.
5379 sp->reset_lex(thd);
4362 5379 sp->m_parser_data.set_current_stmt_start_ptr(@4.raw.end);
4363 }
4364 select_stmt /*$6*/
4365 { /*$7*/
4366
5/10
✓ Branch 0 taken 5377 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5377 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5377 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5377 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 5377 times.
5381 MAKE_CMD($6);
4367
4368 5377 THD *thd= YYTHD;
4369 5377 LEX *cursor_lex= Lex;
4370 5377 sp_head *sp= cursor_lex->sphead;
4371
4372
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5377 times.
5377 assert(cursor_lex->sql_command == SQLCOM_SELECT);
4373
4374
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 5375 times.
5377 if (cursor_lex->result)
4375 {
4376
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_BAD_CURSOR_SELECT, MYF(0));
4377 2 MYSQL_YYABORT;
4378 }
4379
4380 5375 cursor_lex->m_sql_cmd->set_as_part_of_sp();
4381 5375 cursor_lex->sp_lex_in_use= true;
4382
4383
2/4
✓ Branch 0 taken 5375 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5375 times.
5375 if (sp->restore_lex(thd))
4384 MYSQL_YYABORT;
4385
4386 5375 LEX *lex= Lex;
4387 5375 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4388
4389 uint offp;
4390
4391
3/4
✓ Branch 0 taken 5375 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 5373 times.
5375 if (pctx->find_cursor($2, &offp, true))
4392 {
4393
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_DUP_CURS, MYF(0), $2.str);
4394
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 delete cursor_lex;
4395 2 MYSQL_YYABORT;
4396 }
4397
4398 5373 LEX_CSTRING cursor_query= EMPTY_CSTR;
4399
4400
2/2
✓ Branch 0 taken 5361 times.
✓ Branch 1 taken 12 times.
5373 if (cursor_lex->is_metadata_used())
4401 {
4402 cursor_query=
4403
1/2
✓ Branch 0 taken 5361 times.
✗ Branch 1 not taken.
5361 make_string(thd,
4404 sp->m_parser_data.get_current_stmt_start_ptr(),
4405 @6.raw.end);
4406
4407
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5361 times.
5361 if (!cursor_query.str)
4408 MYSQL_YYABORT;
4409 }
4410
4411 sp_instr_cpush *i=
4412
1/2
✓ Branch 0 taken 5373 times.
✗ Branch 1 not taken.
5373 NEW_PTN sp_instr_cpush(sp->instructions(), pctx,
4413 cursor_lex, cursor_query,
4414
3/6
✓ Branch 0 taken 5373 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5373 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5373 times.
✗ Branch 5 not taken.
5373 pctx->current_cursor_count());
4415
4416 10746 if (i == NULL ||
4417
4/8
✓ Branch 0 taken 5373 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5373 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5373 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5373 times.
10746 sp->add_instr(thd, i) ||
4418
2/4
✓ Branch 0 taken 5373 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5373 times.
5373 pctx->add_cursor($2))
4419 {
4420 MYSQL_YYABORT;
4421 }
4422
4423 5373 $$.vars= $$.conds= $$.hndlrs= 0;
4424 5373 $$.curs= 1;
4425 }
4426 ;
4427
4428 sp_handler_type:
4429 1535 EXIT_SYM { $$= sp_handler::EXIT; }
4430 35282 | CONTINUE_SYM { $$= sp_handler::CONTINUE; }
4431 /*| UNDO_SYM { QQ No yet } */
4432 ;
4433
4434 sp_hcond_list:
4435 sp_hcond_element
4436 36780 { $$= 1; }
4437 | sp_hcond_list ',' sp_hcond_element
4438 1174 { $$+= 1; }
4439 ;
4440
4441 sp_hcond_element:
4442 sp_hcond
4443 {
4444 37961 LEX *lex= Lex;
4445 37961 sp_head *sp= lex->sphead;
4446 37961 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4447 37961 sp_pcontext *parent_pctx= pctx->parent_context();
4448
4449
3/4
✓ Branch 0 taken 37961 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✓ Branch 3 taken 37954 times.
37961 if (parent_pctx->check_duplicate_handler($1))
4450 {
4451
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
7 my_error(ER_SP_DUP_HANDLER, MYF(0));
4452 7 MYSQL_YYABORT;
4453 }
4454 else
4455 {
4456 sp_instr_hpush_jump *i=
4457
1/2
✓ Branch 0 taken 37954 times.
✗ Branch 1 not taken.
37954 (sp_instr_hpush_jump *)sp->last_instruction();
4458
4459
1/2
✓ Branch 0 taken 37954 times.
✗ Branch 1 not taken.
37954 i->add_condition($1);
4460 }
4461 }
4462 ;
4463
4464 sp_cond:
4465 ulong_num
4466 { /* mysql errno */
4467
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2891 times.
2893 if ($1 == 0)
4468 {
4469
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_WRONG_VALUE, MYF(0), "CONDITION", "0");
4470 2 MYSQL_YYABORT;
4471 }
4472
1/2
✓ Branch 0 taken 2891 times.
✗ Branch 1 not taken.
2891 $$= NEW_PTN sp_condition_value($1);
4473
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2891 times.
2891 if ($$ == NULL)
4474 MYSQL_YYABORT;
4475 }
4476 | sqlstate
4477 ;
4478
4479 sqlstate:
4480 SQLSTATE_SYM opt_value TEXT_STRING_literal
4481 { /* SQLSTATE */
4482
4483 /*
4484 An error is triggered:
4485 - if the specified string is not a valid SQLSTATE,
4486 - or if it represents the completion condition -- it is not
4487 allowed to SIGNAL, or declare a handler for the completion
4488 condition.
4489 */
4490
7/8
✓ Branch 0 taken 16306 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16279 times.
✓ Branch 3 taken 27 times.
✓ Branch 4 taken 17 times.
✓ Branch 5 taken 16262 times.
✓ Branch 6 taken 44 times.
✓ Branch 7 taken 16262 times.
16306 if (!is_sqlstate_valid(&$3) || is_sqlstate_completion($3.str))
4491 {
4492
1/2
✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
44 my_error(ER_SP_BAD_SQLSTATE, MYF(0), $3.str);
4493 44 MYSQL_YYABORT;
4494 }
4495
1/2
✓ Branch 0 taken 16262 times.
✗ Branch 1 not taken.
16262 $$= NEW_PTN sp_condition_value($3.str);
4496
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16262 times.
16262 if ($$ == NULL)
4497 MYSQL_YYABORT;
4498 }
4499 ;
4500
4501 opt_value:
4502 /* Empty */ {}
4503 | VALUE_SYM {}
4504 ;
4505
4506 sp_hcond:
4507 sp_cond
4508 {
4509 3628 $$= $1;
4510 }
4511 | ident /* CONDITION name */
4512 {
4513 171 LEX *lex= Lex;
4514 171 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4515
4516
1/2
✓ Branch 0 taken 171 times.
✗ Branch 1 not taken.
171 $$= pctx->find_condition($1, false);
4517
4518
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 163 times.
171 if ($$ == NULL)
4519 {
4520
1/2
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
8 my_error(ER_SP_COND_MISMATCH, MYF(0), $1.str);
4521 8 MYSQL_YYABORT;
4522 }
4523 }
4524 | SQLWARNING_SYM /* SQLSTATEs 01??? */
4525 {
4526
1/2
✓ Branch 0 taken 765 times.
✗ Branch 1 not taken.
765 $$= NEW_PTN sp_condition_value(sp_condition_value::WARNING);
4527
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 765 times.
765 if ($$ == NULL)
4528 MYSQL_YYABORT;
4529 }
4530 | not FOUND_SYM /* SQLSTATEs 02??? */
4531 {
4532
1/2
✓ Branch 0 taken 3685 times.
✗ Branch 1 not taken.
3685 $$= NEW_PTN sp_condition_value(sp_condition_value::NOT_FOUND);
4533
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3685 times.
3685 if ($$ == NULL)
4534 MYSQL_YYABORT;
4535 }
4536 | SQLEXCEPTION_SYM /* All other SQLSTATEs */
4537 {
4538
1/2
✓ Branch 0 taken 29720 times.
✗ Branch 1 not taken.
29720 $$= NEW_PTN sp_condition_value(sp_condition_value::EXCEPTION);
4539
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 29720 times.
29720 if ($$ == NULL)
4540 MYSQL_YYABORT;
4541 }
4542 ;
4543
4544 signal_stmt:
4545 SIGNAL_SYM signal_value opt_set_signal_information
4546 {
4547 14040 THD *thd= YYTHD;
4548 14040 LEX *lex= thd->lex;
4549
4550 14040 lex->sql_command= SQLCOM_SIGNAL;
4551
1/2
✓ Branch 0 taken 14040 times.
✗ Branch 1 not taken.
14040 lex->m_sql_cmd= NEW_PTN Sql_cmd_signal($2, $3);
4552
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14040 times.
14040 if (lex->m_sql_cmd == NULL)
4553 MYSQL_YYABORT;
4554 }
4555 ;
4556
4557 signal_value:
4558 ident
4559 {
4560 297 LEX *lex= Lex;
4561 297 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4562
4563
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 295 times.
297 if (!pctx)
4564 {
4565 /* SIGNAL foo cannot be used outside of stored programs */
4566
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_COND_MISMATCH, MYF(0), $1.str);
4567 2 MYSQL_YYABORT;
4568 }
4569
4570
1/2
✓ Branch 0 taken 295 times.
✗ Branch 1 not taken.
295 sp_condition_value *cond= pctx->find_condition($1, false);
4571
4572
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 293 times.
295 if (!cond)
4573 {
4574
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_COND_MISMATCH, MYF(0), $1.str);
4575 2 MYSQL_YYABORT;
4576 }
4577
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 291 times.
293 if (cond->type != sp_condition_value::SQLSTATE)
4578 {
4579
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SIGNAL_BAD_CONDITION_TYPE, MYF(0));
4580 2 MYSQL_YYABORT;
4581 }
4582 291 $$= cond;
4583 }
4584 | sqlstate
4585 13927 { $$= $1; }
4586 ;
4587
4588 opt_signal_value:
4589 /* empty */
4590 90 { $$= NULL; }
4591 | signal_value
4592 156 { $$= $1; }
4593 ;
4594
4595 opt_set_signal_information:
4596 /* empty */
4597
1/2
✓ Branch 0 taken 236 times.
✗ Branch 1 not taken.
472 { $$= NEW_PTN Set_signal_information(); }
4598 | SET_SYM signal_information_item_list
4599 14047 { $$= $2; }
4600 ;
4601
4602 signal_information_item_list:
4603 signal_condition_information_item_name EQ signal_allowed_expr
4604 {
4605
1/2
✓ Branch 0 taken 14053 times.
✗ Branch 1 not taken.
28106 $$= NEW_PTN Set_signal_information();
4606
2/4
✓ Branch 0 taken 14053 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 14053 times.
14053 if ($$->set_item($1, $3))
4607 MYSQL_YYABORT;
4608 }
4609 | signal_information_item_list ','
4610 signal_condition_information_item_name EQ signal_allowed_expr
4611 {
4612 1984 $$= $1;
4613
3/4
✓ Branch 0 taken 1984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 1978 times.
1984 if ($$->set_item($3, $5))
4614 6 MYSQL_YYABORT;
4615 }
4616 ;
4617
4618 /*
4619 Only a limited subset of <expr> are allowed in SIGNAL/RESIGNAL.
4620 */
4621 signal_allowed_expr:
4622 literal_or_null
4623
7/14
✓ Branch 0 taken 10734 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10734 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 10734 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 10734 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 10734 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 10734 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 10734 times.
10734 { ITEMIZE($1, &$$); }
4624 | rvalue_system_or_user_variable
4625
7/14
✓ Branch 0 taken 49 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 49 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 49 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 49 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 49 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 49 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 49 times.
49 { ITEMIZE($1, &$$); }
4626 | simple_ident
4627
7/14
✓ Branch 0 taken 6032 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6032 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6032 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 6032 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 6032 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 6032 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 6032 times.
6032 { ITEMIZE($1, &$$); }
4628 ;
4629
4630 /* conditions that can be set in signal / resignal */
4631 signal_condition_information_item_name:
4632 CLASS_ORIGIN_SYM
4633 17 { $$= CIN_CLASS_ORIGIN; }
4634 | SUBCLASS_ORIGIN_SYM
4635 13 { $$= CIN_SUBCLASS_ORIGIN; }
4636 | CONSTRAINT_CATALOG_SYM
4637 13 { $$= CIN_CONSTRAINT_CATALOG; }
4638 | CONSTRAINT_SCHEMA_SYM
4639 13 { $$= CIN_CONSTRAINT_SCHEMA; }
4640 | CONSTRAINT_NAME_SYM
4641 13 { $$= CIN_CONSTRAINT_NAME; }
4642 | CATALOG_NAME_SYM
4643 13 { $$= CIN_CATALOG_NAME; }
4644 | SCHEMA_NAME_SYM
4645 17 { $$= CIN_SCHEMA_NAME; }
4646 | TABLE_NAME_SYM
4647 17 { $$= CIN_TABLE_NAME; }
4648 | COLUMN_NAME_SYM
4649 13 { $$= CIN_COLUMN_NAME; }
4650 | CURSOR_NAME_SYM
4651 13 { $$= CIN_CURSOR_NAME; }
4652 | MESSAGE_TEXT_SYM
4653 13923 { $$= CIN_MESSAGE_TEXT; }
4654 | MYSQL_ERRNO_SYM
4655 1973 { $$= CIN_MYSQL_ERRNO; }
4656 ;
4657
4658 resignal_stmt:
4659 RESIGNAL_SYM opt_signal_value opt_set_signal_information
4660 {
4661 243 THD *thd= YYTHD;
4662 243 LEX *lex= thd->lex;
4663
4664 243 lex->sql_command= SQLCOM_RESIGNAL;
4665 243 lex->keep_diagnostics= DA_KEEP_DIAGNOSTICS; // RESIGNAL doesn't clear diagnostics
4666
1/2
✓ Branch 0 taken 243 times.
✗ Branch 1 not taken.
243 lex->m_sql_cmd= NEW_PTN Sql_cmd_resignal($2, $3);
4667
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 243 times.
243 if (lex->m_sql_cmd == NULL)
4668 MYSQL_YYABORT;
4669 }
4670 ;
4671
4672 get_diagnostics:
4673 GET_SYM which_area DIAGNOSTICS_SYM diagnostics_information
4674 {
4675 860 Diagnostics_information *info= $4;
4676
4677 860 info->set_which_da($2);
4678
4679 860 Lex->keep_diagnostics= DA_KEEP_DIAGNOSTICS; // GET DIAGS doesn't clear them.
4680 860 Lex->sql_command= SQLCOM_GET_DIAGNOSTICS;
4681
1/2
✓ Branch 0 taken 860 times.
✗ Branch 1 not taken.
860 Lex->m_sql_cmd= NEW_PTN Sql_cmd_get_diagnostics(info);
4682
4683
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 860 times.
860 if (Lex->m_sql_cmd == NULL)
4684 MYSQL_YYABORT;
4685 }
4686 ;
4687
4688 which_area:
4689 /* If <which area> is not specified, then CURRENT is implicit. */
4690 875 { $$= Diagnostics_information::CURRENT_AREA; }
4691 | CURRENT_SYM
4692 18 { $$= Diagnostics_information::CURRENT_AREA; }
4693 | STACKED_SYM
4694 15 { $$= Diagnostics_information::STACKED_AREA; }
4695 ;
4696
4697 diagnostics_information:
4698 statement_information
4699 {
4700
1/2
✓ Branch 0 taken 102 times.
✗ Branch 1 not taken.
102 $$= NEW_PTN Statement_information($1);
4701
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 102 times.
102 if ($$ == NULL)
4702 MYSQL_YYABORT;
4703 }
4704 | CONDITION_SYM condition_number condition_information
4705 {
4706
1/2
✓ Branch 0 taken 758 times.
✗ Branch 1 not taken.
758 $$= NEW_PTN Condition_information($2, $3);
4707
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 758 times.
758 if ($$ == NULL)
4708 MYSQL_YYABORT;
4709 }
4710 ;
4711
4712 statement_information:
4713 statement_information_item
4714 {
4715
1/2
✓ Branch 0 taken 106 times.
✗ Branch 1 not taken.
106 $$= NEW_PTN List<Statement_information_item>;
4716
4/8
✓ Branch 0 taken 106 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 106 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 106 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 106 times.
106 if ($$ == NULL || $$->push_back($1))
4717 MYSQL_YYABORT;
4718 }
4719 | statement_information ',' statement_information_item
4720 {
4721
2/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8 times.
8 if ($1->push_back($3))
4722 MYSQL_YYABORT;
4723 8 $$= $1;
4724 }
4725 ;
4726
4727 statement_information_item:
4728 simple_target_specification EQ statement_information_item_name
4729 {
4730
1/2
✓ Branch 0 taken 114 times.
✗ Branch 1 not taken.
114 $$= NEW_PTN Statement_information_item($3, $1);
4731
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 114 times.
114 if ($$ == NULL)
4732 MYSQL_YYABORT;
4733 }
4734
4735 simple_target_specification:
4736 ident
4737 {
4738 1262 THD *thd= YYTHD;
4739 1262 LEX *lex= thd->lex;
4740 1262 sp_head *sp= lex->sphead;
4741
4742 /*
4743 NOTE: lex->sphead is NULL if we're parsing something like
4744 'GET DIAGNOSTICS v' outside a stored program. We should throw
4745 ER_SP_UNDECLARED_VAR in such cases.
4746 */
4747
4748
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1260 times.
1262 if (!sp)
4749 {
4750
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
4751 2 MYSQL_YYABORT;
4752 }
4753
4754 1260 $$=
4755
1/2
✓ Branch 0 taken 1260 times.
✗ Branch 1 not taken.
2520 create_item_for_sp_var(
4756 1260 thd, to_lex_cstring($1), NULL,
4757 sp->m_parser_data.get_current_stmt_start_ptr(),
4758 @1.raw.start,
4759 @1.raw.end);
4760
4761
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 1254 times.
1260 if ($$ == NULL)
4762 6 MYSQL_YYABORT;
4763 }
4764 | '@' ident_or_text
4765 {
4766
2/4
✓ Branch 0 taken 377 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 377 times.
✗ Branch 3 not taken.
377 $$= NEW_PTN Item_func_get_user_var(@$, $2);
4767
7/14
✓ Branch 0 taken 377 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 377 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 377 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 377 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 377 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 377 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 377 times.
377 ITEMIZE($$, &$$);
4768 }
4769 ;
4770
4771 statement_information_item_name:
4772 NUMBER_SYM
4773 91 { $$= Statement_information_item::NUMBER; }
4774 | ROW_COUNT_SYM
4775 23 { $$= Statement_information_item::ROW_COUNT; }
4776 ;
4777
4778 /*
4779 Only a limited subset of <expr> are allowed in GET DIAGNOSTICS
4780 <condition number>, same subset as for SIGNAL/RESIGNAL.
4781 */
4782 condition_number:
4783 signal_allowed_expr
4784 778 { $$= $1; }
4785 ;
4786
4787 condition_information:
4788 condition_information_item
4789 {
4790
1/2
✓ Branch 0 taken 762 times.
✗ Branch 1 not taken.
762 $$= NEW_PTN List<Condition_information_item>;
4791
4/8
✓ Branch 0 taken 762 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 762 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 762 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 762 times.
762 if ($$ == NULL || $$->push_back($1))
4792 MYSQL_YYABORT;
4793 }
4794 | condition_information ',' condition_information_item
4795 {
4796
2/4
✓ Branch 0 taken 736 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 736 times.
736 if ($1->push_back($3))
4797 MYSQL_YYABORT;
4798 736 $$= $1;
4799 }
4800 ;
4801
4802 condition_information_item:
4803 simple_target_specification EQ condition_information_item_name
4804 {
4805
1/2
✓ Branch 0 taken 1498 times.
✗ Branch 1 not taken.
1498 $$= NEW_PTN Condition_information_item($3, $1);
4806
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1498 times.
1498 if ($$ == NULL)
4807 MYSQL_YYABORT;
4808 }
4809
4810 condition_information_item_name:
4811 CLASS_ORIGIN_SYM
4812 30 { $$= Condition_information_item::CLASS_ORIGIN; }
4813 | SUBCLASS_ORIGIN_SYM
4814 12 { $$= Condition_information_item::SUBCLASS_ORIGIN; }
4815 | CONSTRAINT_CATALOG_SYM
4816 4 { $$= Condition_information_item::CONSTRAINT_CATALOG; }
4817 | CONSTRAINT_SCHEMA_SYM
4818 4 { $$= Condition_information_item::CONSTRAINT_SCHEMA; }
4819 | CONSTRAINT_NAME_SYM
4820 4 { $$= Condition_information_item::CONSTRAINT_NAME; }
4821 | CATALOG_NAME_SYM
4822 4 { $$= Condition_information_item::CATALOG_NAME; }
4823 | SCHEMA_NAME_SYM
4824 4 { $$= Condition_information_item::SCHEMA_NAME; }
4825 | TABLE_NAME_SYM
4826 6 { $$= Condition_information_item::TABLE_NAME; }
4827 | COLUMN_NAME_SYM
4828 4 { $$= Condition_information_item::COLUMN_NAME; }
4829 | CURSOR_NAME_SYM
4830 4 { $$= Condition_information_item::CURSOR_NAME; }
4831 | MESSAGE_TEXT_SYM
4832 732 { $$= Condition_information_item::MESSAGE_TEXT; }
4833 | MYSQL_ERRNO_SYM
4834 678 { $$= Condition_information_item::MYSQL_ERRNO; }
4835 | RETURNED_SQLSTATE_SYM
4836 12 { $$= Condition_information_item::RETURNED_SQLSTATE; }
4837 ;
4838
4839 sp_decl_idents:
4840 ident
4841 {
4842 /* NOTE: field definition is filled in sp_decl section. */
4843
4844 110765 THD *thd= YYTHD;
4845 110765 LEX *lex= thd->lex;
4846 110765 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4847
4848
3/4
✓ Branch 0 taken 110767 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 110766 times.
110765 if (pctx->find_variable($1.str, $1.length, true))
4849 {
4850
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_SP_DUP_VAR, MYF(0), $1.str);
4851 1 MYSQL_YYABORT;
4852 }
4853
4854
1/2
✓ Branch 0 taken 110765 times.
✗ Branch 1 not taken.
110766 pctx->add_variable(thd,
4855 $1,
4856 MYSQL_TYPE_DECIMAL,
4857 sp_variable::MODE_IN);
4858 110765 $$= 1;
4859 }
4860 | sp_decl_idents ',' ident
4861 {
4862 /* NOTE: field definition is filled in sp_decl section. */
4863
4864 14465 THD *thd= YYTHD;
4865 14465 LEX *lex= thd->lex;
4866 14465 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
4867
4868
2/4
✓ Branch 0 taken 14465 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 14465 times.
14465 if (pctx->find_variable($3.str, $3.length, true))
4869 {
4870 my_error(ER_SP_DUP_VAR, MYF(0), $3.str);
4871 MYSQL_YYABORT;
4872 }
4873
4874
1/2
✓ Branch 0 taken 14465 times.
✗ Branch 1 not taken.
14465 pctx->add_variable(thd,
4875 $3,
4876 MYSQL_TYPE_DECIMAL,
4877 sp_variable::MODE_IN);
4878 14465 $$= $1 + 1;
4879 }
4880 ;
4881
4882 sp_opt_default:
4883 /* Empty */
4884 {
4885 67978 $$.expr_start= NULL;
4886 67978 $$.expr = NULL;
4887 }
4888 | DEFAULT_SYM expr
4889 {
4890 42763 $$.expr_start= @1.raw.end;
4891 42763 $$.expr= $2;
4892 }
4893 ;
4894
4895 sp_proc_stmt:
4896 sp_proc_stmt_statement
4897 | sp_proc_stmt_return
4898 | sp_proc_stmt_if
4899 | case_stmt_specification
4900 | sp_labeled_block
4901 | sp_unlabeled_block
4902 | sp_labeled_control
4903 | sp_proc_stmt_unlabeled
4904 | sp_proc_stmt_leave
4905 | sp_proc_stmt_iterate
4906 | sp_proc_stmt_open
4907 | sp_proc_stmt_fetch
4908 | sp_proc_stmt_close
4909 ;
4910
4911 sp_proc_stmt_if:
4912 IF
4913 280943 { Lex->sphead->m_parser_data.new_cont_backpatch(); }
4914 sp_if END IF
4915 {
4916 280881 sp_head *sp= Lex->sphead;
4917
4918
2/4
✓ Branch 0 taken 280881 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 280881 times.
✗ Branch 3 not taken.
280881 sp->m_parser_data.do_cont_backpatch(sp->instructions());
4919 }
4920 ;
4921
4922 sp_proc_stmt_statement:
4923 {
4924 1701531 THD *thd= YYTHD;
4925 1701531 LEX *lex= thd->lex;
4926 1701531 sp_head *sp= lex->sphead;
4927
4928
1/2
✓ Branch 0 taken 1701533 times.
✗ Branch 1 not taken.
1701531 sp->reset_lex(thd);
4929 1701533 sp->m_parser_data.set_current_stmt_start_ptr(yylloc.raw.start);
4930 }
4931 simple_statement
4932 {
4933
2/2
✓ Branch 0 taken 1203553 times.
✓ Branch 1 taken 497403 times.
1700956 if ($2 != nullptr)
4934
7/10
✓ Branch 0 taken 1203554 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1203554 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1203551 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 167 times.
✓ Branch 7 taken 1203384 times.
✓ Branch 8 taken 168 times.
✓ Branch 9 taken 1203383 times.
1203553 MAKE_CMD($2);
4935
4936 1700786 THD *thd= YYTHD;
4937 1700786 LEX *lex= thd->lex;
4938 1700786 sp_head *sp= lex->sphead;
4939
4940
1/2
✓ Branch 0 taken 1700784 times.
✗ Branch 1 not taken.
1700786 sp->m_flags|= sp_get_flags_for_command(lex);
4941
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1700782 times.
1700784 if (lex->sql_command == SQLCOM_CHANGE_DB)
4942 { /* "USE db" doesn't work in a procedure */
4943
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_BADSTATEMENT, MYF(0), "USE");
4944 2 MYSQL_YYABORT;
4945 }
4946
4947 // Mark statement as belonging to a stored procedure:
4948
2/2
✓ Branch 0 taken 1218523 times.
✓ Branch 1 taken 482259 times.
1700782 if (lex->m_sql_cmd != NULL)
4949 1218523 lex->m_sql_cmd->set_as_part_of_sp();
4950
4951 /*
4952 Don't add an instruction for SET statements, since all
4953 instructions for them were already added during processing
4954 of "set" rule.
4955 */
4956
4/6
✓ Branch 0 taken 1323118 times.
✓ Branch 1 taken 377665 times.
✓ Branch 2 taken 1323119 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 377666 times.
1700783 assert((lex->sql_command != SQLCOM_SET_OPTION &&
4957 lex->sql_command != SQLCOM_SET_PASSWORD) ||
4958 lex->var_list.is_empty());
4959
2/2
✓ Branch 0 taken 1323119 times.
✓ Branch 1 taken 377666 times.
1700785 if (lex->sql_command != SQLCOM_SET_OPTION &&
4960
1/2
✓ Branch 0 taken 1323120 times.
✗ Branch 1 not taken.
1323119 lex->sql_command != SQLCOM_SET_PASSWORD)
4961 {
4962 /* Extract the query statement from the tokenizer. */
4963
4964 LEX_CSTRING query=
4965
1/2
✓ Branch 0 taken 1323116 times.
✗ Branch 1 not taken.
1323120 make_string(thd,
4966 sp->m_parser_data.get_current_stmt_start_ptr(),
4967 @2.raw.end);
4968
4969
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1323116 times.
1323116 if (!query.str)
4970 MYSQL_YYABORT;
4971
4972 /* Add instruction. */
4973
4974 sp_instr_stmt *i=
4975
3/6
✓ Branch 0 taken 1323117 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1323119 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1323118 times.
✗ Branch 5 not taken.
1323116 NEW_PTN sp_instr_stmt(sp->instructions(), lex, query);
4976
4977
4/8
✓ Branch 0 taken 1323119 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1323116 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1323116 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1323115 times.
1323118 if (!i || sp->add_instr(thd, i))
4978 MYSQL_YYABORT;
4979 }
4980
4981
2/4
✓ Branch 0 taken 1700782 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1700782 times.
1700780 if (sp->restore_lex(thd))
4982 MYSQL_YYABORT;
4983 }
4984 ;
4985
4986 sp_proc_stmt_return:
4987 RETURN_SYM /*$1*/
4988 { /*$2*/
4989 173373 THD *thd= YYTHD;
4990 173373 LEX *lex= thd->lex;
4991 173373 sp_head *sp= lex->sphead;
4992
4993
1/2
✓ Branch 0 taken 173373 times.
✗ Branch 1 not taken.
173373 sp->reset_lex(thd);
4994 }
4995 expr /*$3*/
4996 { /*$4*/
4997
10/14
✓ Branch 0 taken 173372 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 173372 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 173371 times.
✓ Branch 5 taken 1 times.
✓ Branch 6 taken 173371 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 173371 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 4 times.
✓ Branch 11 taken 173367 times.
✓ Branch 12 taken 5 times.
✓ Branch 13 taken 173367 times.
173372 ITEMIZE($3, &$3);
4998
4999 173367 THD *thd= YYTHD;
5000 173367 LEX *lex= thd->lex;
5001 173367 sp_head *sp= lex->sphead;
5002
5003 /* Extract expression string. */
5004
5005 173367 LEX_CSTRING expr_query= EMPTY_CSTR;
5006
5007 173367 const char *expr_start_ptr= @1.raw.end;
5008
5009
2/2
✓ Branch 0 taken 7281 times.
✓ Branch 1 taken 166086 times.
173367 if (lex->is_metadata_used())
5010 {
5011
1/2
✓ Branch 0 taken 7281 times.
✗ Branch 1 not taken.
7281 expr_query= make_string(thd, expr_start_ptr, @3.raw.end);
5012
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7281 times.
7281 if (!expr_query.str)
5013 MYSQL_YYABORT;
5014 }
5015
5016 /* Check that this is a stored function. */
5017
5018
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 173365 times.
173367 if (sp->m_type != enum_sp_type::FUNCTION)
5019 {
5020
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_BADRETURN, MYF(0));
5021 2 MYSQL_YYABORT;
5022 }
5023
5024 /* Indicate that we've reached RETURN statement. */
5025
5026 173365 sp->m_flags|= sp_head::HAS_RETURN;
5027
5028 /* Add instruction. */
5029
5030 sp_instr_freturn *i=
5031
1/2
✓ Branch 0 taken 173365 times.
✗ Branch 1 not taken.
173365 NEW_PTN sp_instr_freturn(sp->instructions(), lex, $3, expr_query,
5032
2/4
✓ Branch 0 taken 173365 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 173365 times.
✗ Branch 3 not taken.
173365 sp->m_return_field_def.sql_type);
5033
5034 346730 if (i == NULL ||
5035
4/8
✓ Branch 0 taken 173365 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 173365 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 173365 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 173365 times.
346730 sp->add_instr(thd, i) ||
5036
2/4
✓ Branch 0 taken 173365 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 173365 times.
173365 sp->restore_lex(thd))
5037 {
5038 MYSQL_YYABORT;
5039 }
5040 }
5041 ;
5042
5043 sp_proc_stmt_unlabeled:
5044 { /* Unlabeled controls get a secret label. */
5045 7090 THD *thd= YYTHD;
5046 7090 LEX *lex= thd->lex;
5047 7090 sp_head *sp= lex->sphead;
5048 7090 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5049
5050
2/4
✓ Branch 0 taken 7091 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7093 times.
✗ Branch 3 not taken.
7090 pctx->push_label(thd,
5051 EMPTY_CSTR,
5052 sp->instructions());
5053 }
5054 sp_unlabeled_control
5055 {
5056 7023 LEX *lex= Lex;
5057 7023 sp_head *sp= lex->sphead;
5058 7023 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5059
5060
3/6
✓ Branch 0 taken 7024 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7024 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7024 times.
✗ Branch 5 not taken.
7023 sp->m_parser_data.do_backpatch(pctx->pop_label(),
5061 sp->instructions());
5062 }
5063 ;
5064
5065 sp_proc_stmt_leave:
5066 LEAVE_SYM label_ident
5067 {
5068 4944 THD *thd= YYTHD;
5069 4944 LEX *lex= Lex;
5070 4944 sp_head *sp = lex->sphead;
5071 4944 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5072
1/2
✓ Branch 0 taken 4944 times.
✗ Branch 1 not taken.
4944 sp_label *lab= pctx->find_label($2);
5073
5074
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4940 times.
4944 if (! lab)
5075 {
5076
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "LEAVE", $2.str);
5077 4 MYSQL_YYABORT;
5078 }
5079
5080
1/2
✓ Branch 0 taken 4940 times.
✗ Branch 1 not taken.
4940 uint ip= sp->instructions();
5081
5082 /*
5083 When jumping to a BEGIN-END block end, the target jump
5084 points to the block hpop/cpop cleanup instructions,
5085 so we should exclude the block context here.
5086 When jumping to something else (i.e., sp_label::ITERATION),
5087 there are no hpop/cpop at the jump destination,
5088 so we should include the block context here for cleanup.
5089 */
5090 4940 bool exclusive= (lab->type == sp_label::BEGIN);
5091
5092
1/2
✓ Branch 0 taken 4940 times.
✗ Branch 1 not taken.
4940 size_t n= pctx->diff_handlers(lab->ctx, exclusive);
5093
5094
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4936 times.
4940 if (n)
5095 {
5096
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 sp_instr_hpop *hpop= NEW_PTN sp_instr_hpop(ip++, pctx);
5097
5098
4/8
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
4 if (!hpop || sp->add_instr(thd, hpop))
5099 MYSQL_YYABORT;
5100 }
5101
5102
1/2
✓ Branch 0 taken 4940 times.
✗ Branch 1 not taken.
4940 n= pctx->diff_cursors(lab->ctx, exclusive);
5103
5104
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 4938 times.
4940 if (n)
5105 {
5106
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 sp_instr_cpop *cpop= NEW_PTN sp_instr_cpop(ip++, pctx, n);
5107
5108
4/8
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
2 if (!cpop || sp->add_instr(thd, cpop))
5109 MYSQL_YYABORT;
5110 }
5111
5112
1/2
✓ Branch 0 taken 4940 times.
✗ Branch 1 not taken.
4940 sp_instr_jump *i= NEW_PTN sp_instr_jump(ip, pctx);
5113
5114 9880 if (!i ||
5115 /* Jumping forward */
5116
5/10
✓ Branch 0 taken 4940 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4940 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4940 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4940 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 4940 times.
9880 sp->m_parser_data.add_backpatch_entry(i, lab) ||
5117
2/4
✓ Branch 0 taken 4940 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4940 times.
4940 sp->add_instr(thd, i))
5118 MYSQL_YYABORT;
5119 }
5120 ;
5121
5122 sp_proc_stmt_iterate:
5123 ITERATE_SYM label_ident
5124 {
5125 67 THD *thd= YYTHD;
5126 67 LEX *lex= Lex;
5127 67 sp_head *sp= lex->sphead;
5128 67 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5129
1/2
✓ Branch 0 taken 67 times.
✗ Branch 1 not taken.
67 sp_label *lab= pctx->find_label($2);
5130
5131
4/4
✓ Branch 0 taken 61 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 60 times.
67 if (! lab || lab->type != sp_label::ITERATION)
5132 {
5133
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
7 my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "ITERATE", $2.str);
5134 7 MYSQL_YYABORT;
5135 }
5136
5137
1/2
✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
60 uint ip= sp->instructions();
5138
5139 /* Inclusive the dest. */
5140
1/2
✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
60 size_t n= pctx->diff_handlers(lab->ctx, false);
5141
5142
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 56 times.
60 if (n)
5143 {
5144
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 sp_instr_hpop *hpop= NEW_PTN sp_instr_hpop(ip++, pctx);
5145
5146
4/8
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
4 if (!hpop || sp->add_instr(thd, hpop))
5147 MYSQL_YYABORT;
5148 }
5149
5150 /* Inclusive the dest. */
5151
1/2
✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
60 n= pctx->diff_cursors(lab->ctx, false);
5152
5153
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 56 times.
60 if (n)
5154 {
5155
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 sp_instr_cpop *cpop= NEW_PTN sp_instr_cpop(ip++, pctx, n);
5156
5157
4/8
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
4 if (!cpop || sp->add_instr(thd, cpop))
5158 MYSQL_YYABORT;
5159 }
5160
5161 /* Jump back */
5162
1/2
✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
60 sp_instr_jump *i= NEW_PTN sp_instr_jump(ip, pctx, lab->ip);
5163
5164
4/8
✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 60 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 60 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 60 times.
60 if (!i || sp->add_instr(thd, i))
5165 MYSQL_YYABORT;
5166 }
5167 ;
5168
5169 sp_proc_stmt_open:
5170 OPEN_SYM ident
5171 {
5172 5984 THD *thd= YYTHD;
5173 5984 LEX *lex= Lex;
5174 5984 sp_head *sp= lex->sphead;
5175 5984 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5176 uint offset;
5177
5178
3/4
✓ Branch 0 taken 5984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 5982 times.
5984 if (! pctx->find_cursor($2, &offset, false))
5179 {
5180
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str);
5181 2 MYSQL_YYABORT;
5182 }
5183
5184
1/2
✓ Branch 0 taken 5982 times.
✗ Branch 1 not taken.
5982 sp_instr_copen *i= NEW_PTN sp_instr_copen(sp->instructions(), pctx,
5185
1/2
✓ Branch 0 taken 5982 times.
✗ Branch 1 not taken.
5982 offset);
5186
5187
4/8
✓ Branch 0 taken 5982 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5982 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5982 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5982 times.
5982 if (!i || sp->add_instr(thd, i))
5188 MYSQL_YYABORT;
5189 }
5190 ;
5191
5192 sp_proc_stmt_fetch:
5193 FETCH_SYM sp_opt_fetch_noise ident INTO
5194 {
5195 6064 THD *thd= YYTHD;
5196 6064 LEX *lex= Lex;
5197 6064 sp_head *sp= lex->sphead;
5198 6064 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5199 uint offset;
5200
5201
2/4
✓ Branch 0 taken 6064 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6064 times.
6064 if (! pctx->find_cursor($3, &offset, false))
5202 {
5203 my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $3.str);
5204 MYSQL_YYABORT;
5205 }
5206
5207
1/2
✓ Branch 0 taken 6064 times.
✗ Branch 1 not taken.
6064 sp_instr_cfetch *i= NEW_PTN sp_instr_cfetch(sp->instructions(),
5208
2/4
✓ Branch 0 taken 6064 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6064 times.
✗ Branch 3 not taken.
6064 pctx, offset);
5209
5210
4/8
✓ Branch 0 taken 6064 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6064 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 6064 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 6064 times.
6064 if (!i || sp->add_instr(thd, i))
5211 MYSQL_YYABORT;
5212 }
5213 sp_fetch_list
5214 {}
5215 ;
5216
5217 sp_proc_stmt_close:
5218 CLOSE_SYM ident
5219 {
5220 5915 THD *thd= YYTHD;
5221 5915 LEX *lex= Lex;
5222 5915 sp_head *sp= lex->sphead;
5223 5915 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5224 uint offset;
5225
5226
2/4
✓ Branch 0 taken 5915 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5915 times.
5915 if (! pctx->find_cursor($2, &offset, false))
5227 {
5228 my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str);
5229 MYSQL_YYABORT;
5230 }
5231
5232 sp_instr_cclose *i=
5233
2/4
✓ Branch 0 taken 5915 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5915 times.
✗ Branch 3 not taken.
5915 NEW_PTN sp_instr_cclose(sp->instructions(), pctx, offset);
5234
5235
4/8
✓ Branch 0 taken 5915 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5915 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5915 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5915 times.
5915 if (!i || sp->add_instr(thd, i))
5236 MYSQL_YYABORT;
5237 }
5238 ;
5239
5240 sp_opt_fetch_noise:
5241 /* Empty */
5242 | NEXT_SYM FROM
5243 | FROM
5244 ;
5245
5246 sp_fetch_list:
5247 ident
5248 {
5249 6064 LEX *lex= Lex;
5250 6064 sp_head *sp= lex->sphead;
5251 6064 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5252 sp_variable *spv;
5253
5254
4/8
✓ Branch 0 taken 6064 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6064 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 6064 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 6064 times.
6064 if (!pctx || !(spv= pctx->find_variable($1.str, $1.length, false)))
5255 {
5256 my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
5257 MYSQL_YYABORT;
5258 }
5259
5260 /* An SP local variable */
5261
1/2
✓ Branch 0 taken 6064 times.
✗ Branch 1 not taken.
6064 sp_instr_cfetch *i= (sp_instr_cfetch *)sp->last_instruction();
5262
5263
1/2
✓ Branch 0 taken 6064 times.
✗ Branch 1 not taken.
6064 i->add_to_varlist(spv);
5264 }
5265 | sp_fetch_list ',' ident
5266 {
5267 2709 LEX *lex= Lex;
5268 2709 sp_head *sp= lex->sphead;
5269 2709 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5270 sp_variable *spv;
5271
5272
6/8
✓ Branch 0 taken 2709 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2709 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 2708 times.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 2708 times.
2709 if (!pctx || !(spv= pctx->find_variable($3.str, $3.length, false)))
5273 {
5274
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_SP_UNDECLARED_VAR, MYF(0), $3.str);
5275 1 MYSQL_YYABORT;
5276 }
5277
5278 /* An SP local variable */
5279
1/2
✓ Branch 0 taken 2708 times.
✗ Branch 1 not taken.
2708 sp_instr_cfetch *i= (sp_instr_cfetch *)sp->last_instruction();
5280
5281
1/2
✓ Branch 0 taken 2708 times.
✗ Branch 1 not taken.
2708 i->add_to_varlist(spv);
5282 }
5283 ;
5284
5285 sp_if:
5286 { /*$1*/
5287 358536 THD *thd= YYTHD;
5288 358536 LEX *lex= thd->lex;
5289 358536 sp_head *sp= lex->sphead;
5290
5291
1/2
✓ Branch 0 taken 358536 times.
✗ Branch 1 not taken.
358536 sp->reset_lex(thd);
5292 }
5293 expr /*$2*/
5294 { /*$3*/
5295
7/14
✓ Branch 0 taken 358536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 358535 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 358535 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 358535 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 358536 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 358536 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 358536 times.
358536 ITEMIZE($2, &$2);
5296
5297 358536 THD *thd= YYTHD;
5298 358536 LEX *lex= Lex;
5299 358536 sp_head *sp= lex->sphead;
5300 358536 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5301
5302 /* Extract expression string. */
5303
5304 358536 LEX_CSTRING expr_query= EMPTY_CSTR;
5305 358536 const char *expr_start_ptr= @0.raw.end;
5306
5307
2/2
✓ Branch 0 taken 113299 times.
✓ Branch 1 taken 245237 times.
358536 if (lex->is_metadata_used())
5308 {
5309
1/2
✓ Branch 0 taken 113299 times.
✗ Branch 1 not taken.
113299 expr_query= make_string(thd, expr_start_ptr, @2.raw.end);
5310
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 113299 times.
113299 if (!expr_query.str)
5311 MYSQL_YYABORT;
5312 }
5313
5314 sp_instr_jump_if_not *i =
5315
1/2
✓ Branch 0 taken 358536 times.
✗ Branch 1 not taken.
358536 NEW_PTN sp_instr_jump_if_not(sp->instructions(), lex,
5316
2/4
✓ Branch 0 taken 358536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 358536 times.
✗ Branch 3 not taken.
358536 $2, expr_query);
5317
5318 /* Add jump instruction. */
5319
5320 717072 if (i == NULL ||
5321
4/8
✓ Branch 0 taken 358536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 358536 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 358536 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 358536 times.
✗ Branch 7 not taken.
358536 sp->m_parser_data.add_backpatch_entry(
5322 358536 i, pctx->push_label(thd, EMPTY_CSTR, 0)) ||
5323
2/4
✓ Branch 0 taken 358536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 358536 times.
✗ Branch 3 not taken.
358536 sp->m_parser_data.add_cont_backpatch_entry(i) ||
5324
4/8
✓ Branch 0 taken 358536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 358536 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 358536 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 358536 times.
1075608 sp->add_instr(thd, i) ||
5325
2/4
✓ Branch 0 taken 358536 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 358536 times.
358536 sp->restore_lex(thd))
5326 {
5327 MYSQL_YYABORT;
5328 }
5329 }
5330 THEN_SYM /*$4*/
5331 sp_proc_stmts1 /*$5*/
5332 { /*$6*/
5333 358478 THD *thd= YYTHD;
5334 358478 LEX *lex= thd->lex;
5335 358478 sp_head *sp= lex->sphead;
5336 358478 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5337
5338
2/4
✓ Branch 0 taken 358478 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 358477 times.
✗ Branch 3 not taken.
358478 sp_instr_jump *i = NEW_PTN sp_instr_jump(sp->instructions(), pctx);
5339
5340
4/8
✓ Branch 0 taken 358478 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 358478 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 358478 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 358478 times.
358478 if (!i || sp->add_instr(thd, i))
5341 MYSQL_YYABORT;
5342
5343
3/6
✓ Branch 0 taken 358478 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 358478 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 358478 times.
✗ Branch 5 not taken.
358478 sp->m_parser_data.do_backpatch(pctx->pop_label(),
5344 sp->instructions());
5345
5346
3/6
✓ Branch 0 taken 358478 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 358478 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 358477 times.
✗ Branch 5 not taken.
358478 sp->m_parser_data.add_backpatch_entry(
5347 i, pctx->push_label(thd, EMPTY_CSTR, 0));
5348 }
5349 sp_elseifs /*$7*/
5350 { /*$8*/
5351 358477 LEX *lex= Lex;
5352 358477 sp_head *sp= lex->sphead;
5353 358477 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5354
5355
3/6
✓ Branch 0 taken 358477 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 358477 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 358476 times.
✗ Branch 5 not taken.
358477 sp->m_parser_data.do_backpatch(pctx->pop_label(),
5356 sp->instructions());
5357 }
5358 ;
5359
5360 sp_elseifs:
5361 /* Empty */
5362 | ELSEIF_SYM sp_if
5363 | ELSE sp_proc_stmts1
5364 ;
5365
5366 case_stmt_specification:
5367 simple_case_stmt
5368 | searched_case_stmt
5369 ;
5370
5371 simple_case_stmt:
5372 CASE_SYM /*$1*/
5373 { /*$2*/
5374 714 THD *thd= YYTHD;
5375 714 LEX *lex= thd->lex;
5376 714 sp_head *sp= lex->sphead;
5377
5378
1/2
✓ Branch 0 taken 714 times.
✗ Branch 1 not taken.
714 case_stmt_action_case(thd);
5379
5380
1/2
✓ Branch 0 taken 714 times.
✗ Branch 1 not taken.
714 sp->reset_lex(thd); /* For CASE-expr $3 */
5381 }
5382 expr /*$3*/
5383 { /*$4*/
5384
7/14
✓ Branch 0 taken 712 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 712 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 712 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 712 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 712 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 712 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 712 times.
712 ITEMIZE($3, &$3);
5385
5386 712 THD *thd= YYTHD;
5387 712 LEX *lex= Lex;
5388 712 sp_head *sp= lex->sphead;
5389
5390 /* Extract CASE-expression string. */
5391
5392 712 LEX_CSTRING case_expr_query= EMPTY_CSTR;
5393 712 const char *expr_start_ptr= @1.raw.end;
5394
5395
2/2
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 692 times.
712 if (lex->is_metadata_used())
5396 {
5397
1/2
✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
20 case_expr_query= make_string(thd, expr_start_ptr, @3.raw.end);
5398
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
20 if (!case_expr_query.str)
5399 MYSQL_YYABORT;
5400 }
5401
5402 /* Register new CASE-expression and get its id. */
5403
5404 712 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5405
1/2
✓ Branch 0 taken 712 times.
✗ Branch 1 not taken.
712 int case_expr_id= pctx->push_case_expr_id();
5406
5407
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 712 times.
712 if (case_expr_id < 0)
5408 MYSQL_YYABORT;
5409
5410 /* Add CASE-set instruction. */
5411
5412 sp_instr_set_case_expr *i=
5413
1/2
✓ Branch 0 taken 712 times.
✗ Branch 1 not taken.
712 NEW_PTN sp_instr_set_case_expr(sp->instructions(), lex,
5414
2/4
✓ Branch 0 taken 712 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 712 times.
✗ Branch 3 not taken.
712 case_expr_id, $3, case_expr_query);
5415
5416 1424 if (i == NULL ||
5417
2/4
✓ Branch 0 taken 712 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 712 times.
✗ Branch 3 not taken.
712 sp->m_parser_data.add_cont_backpatch_entry(i) ||
5418
4/8
✓ Branch 0 taken 712 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 712 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 712 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 712 times.
2136 sp->add_instr(thd, i) ||
5419
2/4
✓ Branch 0 taken 712 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 712 times.
712 sp->restore_lex(thd))
5420 {
5421 MYSQL_YYABORT;
5422 }
5423 }
5424 simple_when_clause_list /*$5*/
5425 else_clause_opt /*$6*/
5426 END /*$7*/
5427 CASE_SYM /*$8*/
5428 { /*$9*/
5429
1/2
✓ Branch 0 taken 710 times.
✗ Branch 1 not taken.
710 case_stmt_action_end_case(Lex, true);
5430 }
5431 ;
5432
5433 searched_case_stmt:
5434 CASE_SYM
5435 {
5436
1/2
✓ Branch 0 taken 646 times.
✗ Branch 1 not taken.
646 case_stmt_action_case(YYTHD);
5437 }
5438 searched_when_clause_list
5439 else_clause_opt
5440 END
5441 CASE_SYM
5442 {
5443
1/2
✓ Branch 0 taken 642 times.
✗ Branch 1 not taken.
642 case_stmt_action_end_case(Lex, false);
5444 }
5445 ;
5446
5447 simple_when_clause_list:
5448 simple_when_clause
5449 | simple_when_clause_list simple_when_clause
5450 ;
5451
5452 searched_when_clause_list:
5453 searched_when_clause
5454 | searched_when_clause_list searched_when_clause
5455 ;
5456
5457 simple_when_clause:
5458 WHEN_SYM /*$1*/
5459 { /*$2*/
5460 22042 THD *thd= YYTHD;
5461 22042 LEX *lex= thd->lex;
5462 22042 sp_head *sp= lex->sphead;
5463
5464
1/2
✓ Branch 0 taken 22042 times.
✗ Branch 1 not taken.
22042 sp->reset_lex(thd);
5465 }
5466 expr /*$3*/
5467 { /*$4*/
5468 /* Simple case: <caseval> = <whenval> */
5469
5470
7/14
✓ Branch 0 taken 22042 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 22042 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 22042 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 22042 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 22042 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 22042 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 22042 times.
22042 ITEMIZE($3, &$3);
5471
5472 22042 THD *thd= YYTHD;
5473 22042 LEX *lex= thd->lex;
5474 22042 sp_head *sp= lex->sphead;
5475 22042 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5476
5477 /* Extract expression string. */
5478
5479 22042 LEX_CSTRING when_expr_query= EMPTY_CSTR;
5480 22042 const char *expr_start_ptr= @1.raw.end;
5481
5482
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 22040 times.
22042 if (lex->is_metadata_used())
5483 {
5484
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 when_expr_query= make_string(thd, expr_start_ptr, @3.raw.end);
5485
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (!when_expr_query.str)
5486 MYSQL_YYABORT;
5487 }
5488
5489 /* Add CASE-when-jump instruction. */
5490
5491 sp_instr_jump_case_when *i =
5492
1/2
✓ Branch 0 taken 22042 times.
✗ Branch 1 not taken.
22042 NEW_PTN sp_instr_jump_case_when(sp->instructions(), lex,
5493
1/2
✓ Branch 0 taken 22042 times.
✗ Branch 1 not taken.
22042 pctx->get_current_case_expr_id(),
5494
2/4
✓ Branch 0 taken 22042 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 22042 times.
✗ Branch 3 not taken.
22042 $3, when_expr_query);
5495
5496 44084 if (i == NULL ||
5497
2/4
✓ Branch 0 taken 22042 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 22042 times.
✗ Branch 3 not taken.
22042 i->on_after_expr_parsing(thd) ||
5498
4/8
✓ Branch 0 taken 22042 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 22042 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 22042 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 22042 times.
✗ Branch 7 not taken.
22042 sp->m_parser_data.add_backpatch_entry(
5499 22042 i, pctx->push_label(thd, EMPTY_CSTR, 0)) ||
5500
2/4
✓ Branch 0 taken 22042 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 22042 times.
✗ Branch 3 not taken.
22042 sp->m_parser_data.add_cont_backpatch_entry(i) ||
5501
4/8
✓ Branch 0 taken 22042 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 22042 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 22042 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 22042 times.
66126 sp->add_instr(thd, i) ||
5502
2/4
✓ Branch 0 taken 22042 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 22042 times.
22042 sp->restore_lex(thd))
5503 {
5504 MYSQL_YYABORT;
5505 }
5506 }
5507 THEN_SYM /*$5*/
5508 sp_proc_stmts1 /*$6*/
5509 { /*$7*/
5510
2/4
✓ Branch 0 taken 22041 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 22041 times.
22041 if (case_stmt_action_then(YYTHD, Lex))
5511 MYSQL_YYABORT;
5512 }
5513 ;
5514
5515 searched_when_clause:
5516 WHEN_SYM /*$1*/
5517 { /*$2*/
5518 3066 THD *thd= YYTHD;
5519 3066 LEX *lex= thd->lex;
5520 3066 sp_head *sp= lex->sphead;
5521
5522
1/2
✓ Branch 0 taken 3066 times.
✗ Branch 1 not taken.
3066 sp->reset_lex(thd);
5523 }
5524 expr /*$3*/
5525 { /*$4*/
5526
7/14
✓ Branch 0 taken 3066 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3066 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3066 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 3066 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 3066 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 3066 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 3066 times.
3066 ITEMIZE($3, &$3);
5527
5528 3066 THD *thd= YYTHD;
5529 3066 LEX *lex= thd->lex;
5530 3066 sp_head *sp= lex->sphead;
5531 3066 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5532
5533 /* Extract expression string. */
5534
5535 3066 LEX_CSTRING when_query= EMPTY_CSTR;
5536 3066 const char *expr_start_ptr= @1.raw.end;
5537
5538
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 3048 times.
3066 if (lex->is_metadata_used())
5539 {
5540
1/2
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
18 when_query= make_string(thd, expr_start_ptr, @3.raw.end);
5541
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
18 if (!when_query.str)
5542 MYSQL_YYABORT;
5543 }
5544
5545 /* Add jump instruction. */
5546
5547 sp_instr_jump_if_not *i=
5548
1/2
✓ Branch 0 taken 3066 times.
✗ Branch 1 not taken.
3066 NEW_PTN sp_instr_jump_if_not(sp->instructions(), lex, $3,
5549
2/4
✓ Branch 0 taken 3066 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3066 times.
✗ Branch 3 not taken.
3066 when_query);
5550
5551 6132 if (i == NULL ||
5552
4/8
✓ Branch 0 taken 3066 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3066 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3066 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 3066 times.
✗ Branch 7 not taken.
3066 sp->m_parser_data.add_backpatch_entry(
5553 3066 i, pctx->push_label(thd, EMPTY_CSTR, 0)) ||
5554
2/4
✓ Branch 0 taken 3066 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3066 times.
✗ Branch 3 not taken.
3066 sp->m_parser_data.add_cont_backpatch_entry(i) ||
5555
4/8
✓ Branch 0 taken 3066 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3066 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3066 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 3066 times.
9198 sp->add_instr(thd, i) ||
5556
2/4
✓ Branch 0 taken 3066 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3066 times.
3066 sp->restore_lex(thd))
5557 {
5558 MYSQL_YYABORT;
5559 }
5560 }
5561 THEN_SYM /*$6*/
5562 sp_proc_stmts1 /*$7*/
5563 { /*$8*/
5564
2/4
✓ Branch 0 taken 3065 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3065 times.
3065 if (case_stmt_action_then(YYTHD, Lex))
5565 MYSQL_YYABORT;
5566 }
5567 ;
5568
5569 else_clause_opt:
5570 /* empty */
5571 {
5572 84 THD *thd= YYTHD;
5573 84 LEX *lex= Lex;
5574 84 sp_head *sp= lex->sphead;
5575 84 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5576
5577 sp_instr_error *i=
5578 NEW_PTN
5579
2/4
✓ Branch 0 taken 84 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 84 times.
✗ Branch 3 not taken.
84 sp_instr_error(sp->instructions(), pctx, ER_SP_CASE_NOT_FOUND);
5580
5581
4/8
✓ Branch 0 taken 84 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 84 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 84 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 84 times.
84 if (!i || sp->add_instr(thd, i))
5582 MYSQL_YYABORT;
5583 }
5584 | ELSE sp_proc_stmts1
5585 ;
5586
5587 sp_labeled_control:
5588 label_ident ':'
5589 {
5590 5064 LEX *lex= Lex;
5591 5064 sp_head *sp= lex->sphead;
5592 5064 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5593
1/2
✓ Branch 0 taken 5064 times.
✗ Branch 1 not taken.
5064 sp_label *lab= pctx->find_label($1);
5594
5595
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 5061 times.
5064 if (lab)
5596 {
5597
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 my_error(ER_SP_LABEL_REDEFINE, MYF(0), $1.str);
5598 3 MYSQL_YYABORT;
5599 }
5600 else
5601 {
5602
2/4
✓ Branch 0 taken 5061 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5061 times.
✗ Branch 3 not taken.
5061 lab= pctx->push_label(YYTHD, $1, sp->instructions());
5603 5061 lab->type= sp_label::ITERATION;
5604 }
5605 }
5606 sp_unlabeled_control sp_opt_label
5607 {
5608 5026 LEX *lex= Lex;
5609 5026 sp_head *sp= lex->sphead;
5610 5026 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5611
1/2
✓ Branch 0 taken 5026 times.
✗ Branch 1 not taken.
5026 sp_label *lab= pctx->pop_label();
5612
5613
2/2
✓ Branch 0 taken 148 times.
✓ Branch 1 taken 4878 times.
5026 if ($5.str)
5614 {
5615
3/4
✓ Branch 0 taken 148 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✓ Branch 3 taken 141 times.
148 if (my_strcasecmp(system_charset_info, $5.str, lab->name.str) != 0)
5616 {
5617
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
7 my_error(ER_SP_LABEL_MISMATCH, MYF(0), $5.str);
5618 7 MYSQL_YYABORT;
5619 }
5620 }
5621
2/4
✓ Branch 0 taken 5019 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5019 times.
✗ Branch 3 not taken.
5019 sp->m_parser_data.do_backpatch(lab, sp->instructions());
5622 }
5623 ;
5624
5625 sp_opt_label:
5626 4915 /* Empty */ { $$= NULL_CSTR; }
5627 227 | label_ident { $$= $1; }
5628 ;
5629
5630 sp_labeled_block:
5631 label_ident ':'
5632 {
5633 127 LEX *lex= Lex;
5634 127 sp_head *sp= lex->sphead;
5635 127 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5636
1/2
✓ Branch 0 taken 127 times.
✗ Branch 1 not taken.
127 sp_label *lab= pctx->find_label($1);
5637
5638
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 126 times.
127 if (lab)
5639 {
5640
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_SP_LABEL_REDEFINE, MYF(0), $1.str);
5641 1 MYSQL_YYABORT;
5642 }
5643
5644
2/4
✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
126 lab= pctx->push_label(YYTHD, $1, sp->instructions());
5645 126 lab->type= sp_label::BEGIN;
5646 }
5647 sp_block_content sp_opt_label
5648 {
5649 116 LEX *lex= Lex;
5650 116 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5651
1/2
✓ Branch 0 taken 116 times.
✗ Branch 1 not taken.
116 sp_label *lab= pctx->pop_label();
5652
5653
2/2
✓ Branch 0 taken 79 times.
✓ Branch 1 taken 37 times.
116 if ($5.str)
5654 {
5655
3/4
✓ Branch 0 taken 79 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 77 times.
79 if (my_strcasecmp(system_charset_info, $5.str, lab->name.str) != 0)
5656 {
5657
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_LABEL_MISMATCH, MYF(0), $5.str);
5658 2 MYSQL_YYABORT;
5659 }
5660 }
5661 }
5662 ;
5663
5664 sp_unlabeled_block:
5665 { /* Unlabeled blocks get a secret label. */
5666 376707 LEX *lex= Lex;
5667 376707 sp_head *sp= lex->sphead;
5668 376707 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5669
5670 sp_label *lab=
5671
2/4
✓ Branch 0 taken 376709 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 376709 times.
✗ Branch 3 not taken.
376707 pctx->push_label(YYTHD, EMPTY_CSTR, sp->instructions());
5672
5673 376709 lab->type= sp_label::BEGIN;
5674 }
5675 sp_block_content
5676 {
5677 375383 LEX *lex= Lex;
5678
1/2
✓ Branch 0 taken 375382 times.
✗ Branch 1 not taken.
375383 lex->get_sp_current_parsing_ctx()->pop_label();
5679 }
5680 ;
5681
5682 sp_block_content:
5683 BEGIN_SYM
5684 { /* QQ This is just a dummy for grouping declarations and statements
5685 together. No [[NOT] ATOMIC] yet, and we need to figure out how
5686 make it coexist with the existing BEGIN COMMIT/ROLLBACK. */
5687 376837 THD *thd= YYTHD;
5688 376837 LEX *lex= thd->lex;
5689 376837 sp_pcontext *parent_pctx= lex->get_sp_current_parsing_ctx();
5690
5691 sp_pcontext *child_pctx=
5692
1/2
✓ Branch 0 taken 376836 times.
✗ Branch 1 not taken.
376836 parent_pctx->push_context(thd, sp_pcontext::REGULAR_SCOPE);
5693
5694 376836 lex->set_sp_current_parsing_ctx(child_pctx);
5695 }
5696 sp_decls
5697 sp_proc_stmts
5698 END
5699 {
5700 375498 THD *thd= YYTHD;
5701 375498 LEX *lex= Lex;
5702 375498 sp_head *sp= lex->sphead;
5703 375498 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5704
5705 // We always have a label.
5706
3/6
✓ Branch 0 taken 375498 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 375499 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 375499 times.
✗ Branch 5 not taken.
375498 sp->m_parser_data.do_backpatch(pctx->last_label(),
5707 sp->instructions());
5708
5709
2/2
✓ Branch 0 taken 35807 times.
✓ Branch 1 taken 339692 times.
375499 if ($3.hndlrs)
5710 {
5711
2/4
✓ Branch 0 taken 35807 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35807 times.
✗ Branch 3 not taken.
35807 sp_instr *i= NEW_PTN sp_instr_hpop(sp->instructions(), pctx);
5712
5713
4/8
✓ Branch 0 taken 35807 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35807 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 35807 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 35807 times.
35807 if (!i || sp->add_instr(thd, i))
5714 MYSQL_YYABORT;
5715 }
5716
5717
2/2
✓ Branch 0 taken 4325 times.
✓ Branch 1 taken 371174 times.
375499 if ($3.curs)
5718 {
5719
1/2
✓ Branch 0 taken 4325 times.
✗ Branch 1 not taken.
4325 sp_instr *i= NEW_PTN sp_instr_cpop(sp->instructions(), pctx,
5720
1/2
✓ Branch 0 taken 4325 times.
✗ Branch 1 not taken.
4325 $3.curs);
5721
5722
4/8
✓ Branch 0 taken 4325 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4325 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4325 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4325 times.
4325 if (!i || sp->add_instr(thd, i))
5723 MYSQL_YYABORT;
5724 }
5725
5726
1/2
✓ Branch 0 taken 375498 times.
✗ Branch 1 not taken.
375499 lex->set_sp_current_parsing_ctx(pctx->pop_context());
5727 }
5728 ;
5729
5730 sp_unlabeled_control:
5731 LOOP_SYM
5732 sp_proc_stmts1 END LOOP_SYM
5733 {
5734 4937 THD *thd= YYTHD;
5735 4937 LEX *lex= Lex;
5736 4937 sp_head *sp= lex->sphead;
5737 4937 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5738
5739
1/2
✓ Branch 0 taken 4937 times.
✗ Branch 1 not taken.
4937 sp_instr_jump *i= NEW_PTN sp_instr_jump(sp->instructions(), pctx,
5740
2/4
✓ Branch 0 taken 4937 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4937 times.
✗ Branch 3 not taken.
4937 pctx->last_label()->ip);
5741
5742
4/8
✓ Branch 0 taken 4937 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4937 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4937 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4937 times.
4937 if (!i || sp->add_instr(thd, i))
5743 MYSQL_YYABORT;
5744 }
5745 | WHILE_SYM /*$1*/
5746 { /*$2*/
5747 5450 THD *thd= YYTHD;
5748 5450 LEX *lex= thd->lex;
5749 5450 sp_head *sp= lex->sphead;
5750
5751
1/2
✓ Branch 0 taken 5453 times.
✗ Branch 1 not taken.
5450 sp->reset_lex(thd);
5752 }
5753 expr /*$3*/
5754 { /*$4*/
5755
7/14
✓ Branch 0 taken 5450 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5451 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5451 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5451 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 5451 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 5451 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 5451 times.
5452 ITEMIZE($3, &$3);
5756
5757 5451 THD *thd= YYTHD;
5758 5451 LEX *lex= Lex;
5759 5451 sp_head *sp= lex->sphead;
5760 5451 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5761
5762 /* Extract expression string. */
5763
5764 5451 LEX_CSTRING expr_query= EMPTY_CSTR;
5765 5451 const char *expr_start_ptr= @1.raw.end;
5766
5767
2/2
✓ Branch 0 taken 606 times.
✓ Branch 1 taken 4845 times.
5451 if (lex->is_metadata_used())
5768 {
5769
1/2
✓ Branch 0 taken 606 times.
✗ Branch 1 not taken.
606 expr_query= make_string(thd, expr_start_ptr, @3.raw.end);
5770
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 606 times.
606 if (!expr_query.str)
5771 MYSQL_YYABORT;
5772 }
5773
5774 /* Add jump instruction. */
5775
5776 sp_instr_jump_if_not *i=
5777 NEW_PTN
5778
3/6
✓ Branch 0 taken 5450 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5449 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5450 times.
✗ Branch 5 not taken.
5451 sp_instr_jump_if_not(sp->instructions(), lex, $3, expr_query);
5779
5780 10903 if (i == NULL ||
5781 /* Jumping forward */
5782
6/10
✓ Branch 0 taken 5450 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5450 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5451 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5451 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 5450 times.
✓ Branch 9 taken 1 times.
10902 sp->m_parser_data.add_backpatch_entry(i, pctx->last_label()) ||
5783 5451 sp->m_parser_data.new_cont_backpatch() ||
5784
2/4
✓ Branch 0 taken 5449 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5449 times.
✗ Branch 3 not taken.
5450 sp->m_parser_data.add_cont_backpatch_entry(i) ||
5785
4/8
✓ Branch 0 taken 5451 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5452 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5452 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5452 times.
16352 sp->add_instr(thd, i) ||
5786
2/4
✓ Branch 0 taken 5452 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5452 times.
5452 sp->restore_lex(thd))
5787 {
5788 MYSQL_YYABORT;
5789 }
5790 }
5791 DO_SYM /*$10*/
5792 sp_proc_stmts1 /*$11*/
5793 END /*$12*/
5794 WHILE_SYM /*$13*/
5795 { /*$14*/
5796 5446 THD *thd= YYTHD;
5797 5446 LEX *lex= Lex;
5798 5446 sp_head *sp= lex->sphead;
5799 5446 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5800
5801
1/2
✓ Branch 0 taken 5446 times.
✗ Branch 1 not taken.
5446 sp_instr_jump *i= NEW_PTN sp_instr_jump(sp->instructions(), pctx,
5802
2/4
✓ Branch 0 taken 5445 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5444 times.
✗ Branch 3 not taken.
5446 pctx->last_label()->ip);
5803
5804
5/8
✓ Branch 0 taken 5445 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 5445 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5446 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5446 times.
5446 if (!i || sp->add_instr(thd, i))
5805 MYSQL_YYABORT;
5806
5807
2/4
✓ Branch 0 taken 5446 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5446 times.
✗ Branch 3 not taken.
5446 sp->m_parser_data.do_cont_backpatch(sp->instructions());
5808 }
5809 | REPEAT_SYM /*$1*/
5810 sp_proc_stmts1 /*$2*/
5811 UNTIL_SYM /*$3*/
5812 { /*$4*/
5813 1668 THD *thd= YYTHD;
5814 1668 LEX *lex= thd->lex;
5815 1668 sp_head *sp= lex->sphead;
5816
5817
1/2
✓ Branch 0 taken 1668 times.
✗ Branch 1 not taken.
1668 sp->reset_lex(thd);
5818 }
5819 expr /*$5*/
5820 { /*$6*/
5821
7/14
✓ Branch 0 taken 1668 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1668 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1668 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1668 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1668 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 1668 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 1668 times.
1668 ITEMIZE($5, &$5);
5822
5823 1668 THD *thd= YYTHD;
5824 1668 LEX *lex= thd->lex;
5825 1668 sp_head *sp= lex->sphead;
5826 1668 sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
5827
1/2
✓ Branch 0 taken 1668 times.
✗ Branch 1 not taken.
1668 uint ip= sp->instructions();
5828
5829 /* Extract expression string. */
5830
5831 1668 LEX_CSTRING expr_query= EMPTY_CSTR;
5832 1668 const char *expr_start_ptr= @3.raw.end;
5833
5834
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 1654 times.
1668 if (lex->is_metadata_used())
5835 {
5836
1/2
✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
14 expr_query= make_string(thd, expr_start_ptr, @5.raw.end);
5837
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
14 if (!expr_query.str)
5838 MYSQL_YYABORT;
5839 }
5840
5841 /* Add jump instruction. */
5842
5843 sp_instr_jump_if_not *i=
5844 NEW_PTN sp_instr_jump_if_not(ip, lex, $5, expr_query,
5845
3/6
✓ Branch 0 taken 1668 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1668 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1668 times.
✗ Branch 5 not taken.
1668 pctx->last_label()->ip);
5846
5847 3336 if (i == NULL ||
5848
4/8
✓ Branch 0 taken 1668 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1668 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1668 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1668 times.
3336 sp->add_instr(thd, i) ||
5849
2/4
✓ Branch 0 taken 1668 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1668 times.
1668 sp->restore_lex(thd))
5850 {
5851 MYSQL_YYABORT;
5852 }
5853
5854 /* We can shortcut the cont_backpatch here */
5855 1668 i->set_cont_dest(ip + 1);
5856 }
5857 END /*$7*/
5858 REPEAT_SYM /*$8*/
5859 ;
5860
5861 trg_action_time:
5862 BEFORE_SYM
5863 42961 { $$= TRG_ACTION_BEFORE; }
5864 | AFTER_SYM
5865 3892 { $$= TRG_ACTION_AFTER; }
5866 ;
5867
5868 trg_event:
5869 INSERT_SYM
5870 40544 { $$= TRG_EVENT_INSERT; }
5871 | UPDATE_SYM
5872 4813 { $$= TRG_EVENT_UPDATE; }
5873 | DELETE_SYM
5874 1488 { $$= TRG_EVENT_DELETE; }
5875 ;
5876 /*
5877 This part of the parser contains common code for all TABLESPACE
5878 commands.
5879 CREATE TABLESPACE_SYM name ...
5880 ALTER TABLESPACE_SYM name ADD DATAFILE ...
5881 CREATE LOGFILE GROUP_SYM name ...
5882 ALTER LOGFILE GROUP_SYM name ADD UNDOFILE ..
5883 DROP TABLESPACE_SYM name
5884 DROP LOGFILE GROUP_SYM name
5885 */
5886
5887 opt_ts_datafile_name:
5888 137 /* empty */ { $$= { nullptr, 0}; }
5889 | ADD ts_datafile
5890 {
5891 951 $$ = $2;
5892 }
5893 ;
5894
5895 opt_logfile_group_name:
5896 1084 /* empty */ { $$= { nullptr, 0}; }
5897 | USE_SYM LOGFILE_SYM GROUP_SYM ident
5898 {
5899 4 $$= $4;
5900 }
5901 ;
5902
5903 opt_tablespace_options:
5904 285 /* empty */ { $$= NULL; }
5905 | tablespace_option_list
5906 ;
5907
5908 tablespace_option_list:
5909 tablespace_option
5910 {
5911
2/4
✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 800 times.
✗ Branch 3 not taken.
800 $$= NEW_PTN Mem_root_array<PT_alter_tablespace_option_base*>(YYMEM_ROOT);
5912
4/8
✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 800 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 800 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 800 times.
800 if ($$ == NULL || $$->push_back($1))
5913 MYSQL_YYABORT; /* purecov: inspected */ // OOM
5914 }
5915 | tablespace_option_list opt_comma tablespace_option
5916 {
5917 258 $$= $1;
5918
2/4
✓ Branch 0 taken 258 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 258 times.
258 if ($$->push_back($3))
5919 MYSQL_YYABORT; /* purecov: inspected */ // OOM
5920 }
5921 ;
5922
5923 tablespace_option:
5924 ts_option_initial_size
5925 | ts_option_autoextend_size
5926 | ts_option_max_size
5927 | ts_option_extent_size
5928 | ts_option_nodegroup
5929 | ts_option_engine
5930 | ts_option_wait
5931 | ts_option_comment
5932 | ts_option_file_block_size
5933 | ts_option_encryption
5934 | ts_option_encryption_key_id
5935 | ts_option_engine_attribute
5936 ;
5937
5938 opt_alter_tablespace_options:
5939 21 /* empty */ { $$= NULL; }
5940 | alter_tablespace_option_list
5941 ;
5942
5943 alter_tablespace_option_list:
5944 alter_tablespace_option
5945 {
5946
2/4
✓ Branch 0 taken 558 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 558 times.
✗ Branch 3 not taken.
558 $$= NEW_PTN Mem_root_array<PT_alter_tablespace_option_base*>(YYMEM_ROOT);
5947
4/8
✓ Branch 0 taken 558 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 558 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 558 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 558 times.
558 if ($$ == NULL || $$->push_back($1))
5948 MYSQL_YYABORT; /* purecov: inspected */ // OOM
5949 }
5950 | alter_tablespace_option_list opt_comma alter_tablespace_option
5951 {
5952 1 $$= $1;
5953
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if ($$->push_back($3))
5954 MYSQL_YYABORT; /* purecov: inspected */ // OOM
5955 }
5956 ;
5957
5958 alter_tablespace_option:
5959 ts_option_initial_size
5960 | ts_option_autoextend_size
5961 | ts_option_max_size
5962 | ts_option_engine
5963 | ts_option_wait
5964 | ts_option_encryption
5965 | ts_option_encryption_key_id
5966 | ts_option_engine_attribute
5967 ;
5968
5969 opt_undo_tablespace_options:
5970 1298 /* empty */ { $$= NULL; }
5971 | undo_tablespace_option_list
5972 ;
5973
5974 undo_tablespace_option_list:
5975 undo_tablespace_option
5976 {
5977
2/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
8 $$= NEW_PTN Mem_root_array<PT_alter_tablespace_option_base*>(YYMEM_ROOT);
5978
4/8
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 8 times.
8 if ($$ == NULL || $$->push_back($1))
5979 MYSQL_YYABORT; // OOM
5980 }
5981 | undo_tablespace_option_list opt_comma undo_tablespace_option
5982 {
5983 $$= $1;
5984 if ($$->push_back($3))
5985 MYSQL_YYABORT; // OOM
5986 }
5987 ;
5988
5989 undo_tablespace_option:
5990 ts_option_engine
5991 ;
5992
5993 opt_logfile_group_options:
5994 2 /* empty */ { $$= NULL; }
5995 | logfile_group_option_list
5996 ;
5997
5998 logfile_group_option_list:
5999 logfile_group_option
6000 {
6001
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 $$= NEW_PTN Mem_root_array<PT_alter_tablespace_option_base*>(YYMEM_ROOT);
6002
4/8
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 3 times.
3 if ($$ == NULL || $$->push_back($1))
6003 MYSQL_YYABORT; /* purecov: inspected */ // OOM
6004 }
6005 | logfile_group_option_list opt_comma logfile_group_option
6006 {
6007 2 $$= $1;
6008
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
2 if ($$->push_back($3))
6009 MYSQL_YYABORT; /* purecov: inspected */ // OOM
6010 }
6011 ;
6012
6013 logfile_group_option:
6014 ts_option_initial_size
6015 | ts_option_undo_buffer_size
6016 | ts_option_redo_buffer_size
6017 | ts_option_nodegroup
6018 | ts_option_engine
6019 | ts_option_wait
6020 | ts_option_comment
6021 ;
6022
6023 opt_alter_logfile_group_options:
6024 /* empty */ { $$= NULL; }
6025 | alter_logfile_group_option_list
6026 ;
6027
6028 alter_logfile_group_option_list:
6029 alter_logfile_group_option
6030 {
6031
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 $$= NEW_PTN Mem_root_array<PT_alter_tablespace_option_base*>(YYMEM_ROOT);
6032
4/8
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
4 if ($$ == NULL || $$->push_back($1))
6033 MYSQL_YYABORT; /* purecov: inspected */ // OOM
6034 }
6035 | alter_logfile_group_option_list opt_comma alter_logfile_group_option
6036 {
6037 2 $$= $1;
6038
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
2 if ($$->push_back($3))
6039 MYSQL_YYABORT; /* purecov: inspected */ // OOM
6040 }
6041 ;
6042
6043 alter_logfile_group_option:
6044 ts_option_initial_size
6045 | ts_option_engine
6046 | ts_option_wait
6047 ;
6048
6049 ts_datafile:
6050 1369 DATAFILE_SYM TEXT_STRING_sys { $$= $2; }
6051 ;
6052
6053 undo_tablespace_state:
6054 100 ACTIVE_SYM { $$= ALTER_UNDO_TABLESPACE_SET_ACTIVE; }
6055 465 | INACTIVE_SYM { $$= ALTER_UNDO_TABLESPACE_SET_INACTIVE; }
6056 ;
6057
6058 lg_undofile:
6059 9 UNDOFILE_SYM TEXT_STRING_sys { $$= $2; }
6060 ;
6061
6062 ts_option_initial_size:
6063 INITIAL_SIZE_SYM opt_equal size_number
6064 {
6065
1/2
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
25 $$= NEW_PTN PT_alter_tablespace_option_initial_size($3);
6066 }
6067 ;
6068
6069 ts_option_autoextend_size:
6070 option_autoextend_size
6071 {
6072
1/2
✓ Branch 0 taken 66 times.
✗ Branch 1 not taken.
66 $$ = NEW_PTN PT_alter_tablespace_option_autoextend_size($1);
6073 }
6074 ;
6075
6076 option_autoextend_size:
6077 201 AUTOEXTEND_SIZE_SYM opt_equal size_number { $$ = $3; }
6078 ;
6079
6080 ts_option_max_size:
6081 MAX_SIZE_SYM opt_equal size_number
6082 {
6083
1/2
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
18 $$= NEW_PTN PT_alter_tablespace_option_max_size($3);
6084 }
6085 ;
6086
6087 ts_option_extent_size:
6088 EXTENT_SIZE_SYM opt_equal size_number
6089 {
6090
1/2
✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
19 $$= NEW_PTN PT_alter_tablespace_option_extent_size($3);
6091 }
6092 ;
6093
6094 ts_option_undo_buffer_size:
6095 UNDO_BUFFER_SIZE_SYM opt_equal size_number
6096 {
6097
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 $$= NEW_PTN PT_alter_tablespace_option_undo_buffer_size($3);
6098 }
6099 ;
6100
6101 ts_option_redo_buffer_size:
6102 REDO_BUFFER_SIZE_SYM opt_equal size_number
6103 {
6104 $$= NEW_PTN PT_alter_tablespace_option_redo_buffer_size($3);
6105 }
6106 ;
6107
6108 ts_option_nodegroup:
6109 NODEGROUP_SYM opt_equal real_ulong_num
6110 {
6111
2/4
✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 19 times.
✗ Branch 3 not taken.
19 $$= NEW_PTN PT_alter_tablespace_option_nodegroup($3);
6112 }
6113 ;
6114
6115 ts_option_comment:
6116 COMMENT_SYM opt_equal TEXT_STRING_sys
6117 {
6118
2/4
✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
✗ Branch 3 not taken.
20 $$= NEW_PTN PT_alter_tablespace_option_comment($3);
6119 }
6120 ;
6121
6122 ts_option_engine:
6123 opt_storage ENGINE_SYM opt_equal ident_or_text
6124 {
6125
2/4
✓ Branch 0 taken 310 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 310 times.
✗ Branch 3 not taken.
310 $$= NEW_PTN PT_alter_tablespace_option_engine(to_lex_cstring($4));
6126 }
6127 ;
6128
6129 ts_option_file_block_size:
6130 FILE_BLOCK_SIZE_SYM opt_equal size_number
6131 {
6132
2/4
✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 57 times.
✗ Branch 3 not taken.
57 $$= NEW_PTN PT_alter_tablespace_option_file_block_size($3);
6133 }
6134 ;
6135
6136 ts_option_wait:
6137 WAIT_SYM
6138 {
6139
1/2
✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
20 $$= NEW_PTN PT_alter_tablespace_option_wait_until_completed(true);
6140 }
6141 | NO_WAIT_SYM
6142 {
6143
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 $$= NEW_PTN PT_alter_tablespace_option_wait_until_completed(false);
6144 }
6145 ;
6146
6147 ts_option_encryption:
6148 ENCRYPTION_SYM opt_equal TEXT_STRING_sys
6149 {
6150
1/2
✓ Branch 0 taken 1078 times.
✗ Branch 1 not taken.
1078 $$= NEW_PTN PT_alter_tablespace_option_encryption($3);
6151 }
6152 ;
6153
6154 ts_option_encryption_key_id:
6155 ENCRYPTION_KEY_ID_SYM opt_equal real_ulong_num
6156 {
6157
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
4 if ($3 >= UINT_MAX32)
6158 {
6159
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_ENCRYPTION_KEY_ID_VALUE_OUT_OF_RANGE, MYF(0), $3,
6160 UINT_MAX32 - 1);
6161 2 MYSQL_YYABORT;
6162 }
6163
6164
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 $$= NEW_PTN PT_alter_tablespace_option_encryption_key_id($3);
6165 }
6166 ;
6167
6168 ts_option_engine_attribute:
6169 ENGINE_ATTRIBUTE_SYM opt_equal json_attribute
6170 {
6171
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 $$ = make_tablespace_engine_attribute(YYMEM_ROOT, $3);
6172 }
6173 ;
6174
6175 size_number:
6176 27 real_ulonglong_num { $$= $1;}
6177 | IDENT_sys
6178 {
6179 ulonglong number;
6180 294 uint text_shift_number= 0;
6181 longlong prefix_number;
6182 294 const char *start_ptr= $1.str;
6183 294 size_t str_len= $1.length;
6184 294 const char *end_ptr= start_ptr + str_len;
6185 int error;
6186
1/2
✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
294 prefix_number= my_strtoll10(start_ptr, &end_ptr, &error);
6187
1/2
✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
294 if ((start_ptr + str_len - 1) == end_ptr)
6188 {
6189
3/4
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 229 times.
✓ Branch 2 taken 58 times.
✗ Branch 3 not taken.
294 switch (end_ptr[0])
6190 {
6191 7 case 'g':
6192 case 'G':
6193 7 text_shift_number+=10;
6194 [[fallthrough]];
6195 236 case 'm':
6196 case 'M':
6197 236 text_shift_number+=10;
6198 [[fallthrough]];
6199 294 case 'k':
6200 case 'K':
6201 294 text_shift_number+=10;
6202 294 break;
6203 default:
6204 {
6205 my_error(ER_WRONG_SIZE_NUMBER, MYF(0));
6206 MYSQL_YYABORT;
6207 }
6208 }
6209
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 294 times.
294 if (prefix_number >> 31)
6210 {
6211 my_error(ER_SIZE_OVERFLOW_ERROR, MYF(0));
6212 MYSQL_YYABORT;
6213 }
6214 294 number= prefix_number << text_shift_number;
6215 }
6216 else
6217 {
6218 my_error(ER_WRONG_SIZE_NUMBER, MYF(0));
6219 MYSQL_YYABORT;
6220 }
6221 294 $$= number;
6222 }
6223 ;
6224
6225 /*
6226 End tablespace part
6227 */
6228
6229 /*
6230 To avoid grammar conflicts, we introduce the next few rules in very details:
6231 we workaround empty rules for optional AS and DUPLICATE clauses by expanding
6232 them in place of the caller rule:
6233
6234 opt_create_table_options_etc ::=
6235 create_table_options opt_create_partitioning_etc
6236 | opt_create_partitioning_etc
6237
6238 opt_create_partitioning_etc ::=
6239 partitioin [opt_duplicate_as_qe] | [opt_duplicate_as_qe]
6240
6241 opt_duplicate_as_qe ::=
6242 duplicate as_create_query_expression
6243 | as_create_query_expression
6244
6245 as_create_query_expression ::=
6246 AS query_expression_or_parens
6247 | query_expression_or_parens
6248
6249 */
6250
6251 opt_create_table_options_etc:
6252 create_table_options
6253 opt_create_partitioning_etc
6254 {
6255 555949 $$= $2;
6256 555949 $$.opt_create_table_options= $1;
6257 }
6258 | opt_create_partitioning_etc
6259 ;
6260
6261 opt_create_partitioning_etc:
6262 partition_clause opt_duplicate_as_qe
6263 {
6264 4091 $$= $2;
6265 4091 $$.opt_partitioning= $1;
6266 }
6267 | opt_duplicate_as_qe
6268 ;
6269
6270 opt_duplicate_as_qe:
6271 /* empty */
6272 {
6273 665146 $$.opt_create_table_options= NULL;
6274 665146 $$.opt_partitioning= NULL;
6275 665146 $$.on_duplicate= On_duplicate::ERROR;
6276 665146 $$.opt_query_expression= NULL;
6277 }
6278 | duplicate
6279 as_create_query_expression
6280 {
6281 14 $$.opt_create_table_options= NULL;
6282 14 $$.opt_partitioning= NULL;
6283 14 $$.on_duplicate= $1;
6284 14 $$.opt_query_expression= $2;
6285 }
6286 | as_create_query_expression
6287 {
6288 9964 $$.opt_create_table_options= NULL;
6289 9964 $$.opt_partitioning= NULL;
6290 9964 $$.on_duplicate= On_duplicate::ERROR;
6291 9964 $$.opt_query_expression= $1;
6292 }
6293 ;
6294
6295 as_create_query_expression:
6296 5303 AS query_expression_or_parens { $$ = $2; }
6297 4675 | query_expression_or_parens { $$ = $1; }
6298 ;
6299
6300 /*
6301 This part of the parser is about handling of the partition information.
6302
6303 It's first version was written by Mikael Ronström with lots of answers to
6304 questions provided by Antony Curtis.
6305
6306 The partition grammar can be called from two places.
6307 1) CREATE TABLE ... PARTITION ..
6308 2) ALTER TABLE table_name PARTITION ...
6309 */
6310 partition_clause:
6311 PARTITION_SYM BY part_type_def opt_num_parts opt_sub_part
6312 opt_part_defs
6313 {
6314
2/4
✓ Branch 0 taken 24430 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24430 times.
✗ Branch 3 not taken.
24430 $$= NEW_PTN PT_partition($3, $4, $5, @6, $6);
6315 }
6316 ;
6317
6318 part_type_def:
6319 opt_linear KEY_SYM opt_key_algo '(' opt_name_list ')'
6320 {
6321
2/4
✓ Branch 0 taken 3891 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3891 times.
✗ Branch 3 not taken.
3891 $$= NEW_PTN PT_part_type_def_key($1, $3, $5);
6322 }
6323 | opt_linear HASH_SYM '(' bit_expr ')'
6324 {
6325
2/4
✓ Branch 0 taken 7112 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7112 times.
✗ Branch 3 not taken.
7112 $$= NEW_PTN PT_part_type_def_hash($1, @4, $4);
6326 }
6327 | RANGE_SYM '(' bit_expr ')'
6328 {
6329
2/4
✓ Branch 0 taken 9564 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9564 times.
✗ Branch 3 not taken.
9564 $$= NEW_PTN PT_part_type_def_range_expr(@3, $3);
6330 }
6331 | RANGE_SYM COLUMNS '(' name_list ')'
6332 {
6333
2/4
✓ Branch 0 taken 437 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 437 times.
✗ Branch 3 not taken.
437 $$= NEW_PTN PT_part_type_def_range_columns($4);
6334 }
6335 | LIST_SYM '(' bit_expr ')'
6336 {
6337
2/4
✓ Branch 0 taken 3268 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3268 times.
✗ Branch 3 not taken.
3268 $$= NEW_PTN PT_part_type_def_list_expr(@3, $3);
6338 }
6339 | LIST_SYM COLUMNS '(' name_list ')'
6340 {
6341
2/4
✓ Branch 0 taken 229 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 229 times.
✗ Branch 3 not taken.
229 $$= NEW_PTN PT_part_type_def_list_columns($4);
6342 }
6343 ;
6344
6345 opt_linear:
6346 15059 /* empty */ { $$= false; }
6347 336 | LINEAR_SYM { $$= true; }
6348 ;
6349
6350 opt_key_algo:
6351 /* empty */
6352 812 { $$= enum_key_algorithm::KEY_ALGORITHM_NONE; }
6353 | ALGORITHM_SYM EQ real_ulong_num
6354 {
6355
3/3
✓ Branch 0 taken 42 times.
✓ Branch 1 taken 3937 times.
✓ Branch 2 taken 1 times.
3980 switch ($3) {
6356 42 case 1:
6357 42 $$= enum_key_algorithm::KEY_ALGORITHM_51;
6358 42 break;
6359 3937 case 2:
6360 3937 $$= enum_key_algorithm::KEY_ALGORITHM_55;
6361 3937 break;
6362 1 default:
6363
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 YYTHD->syntax_error();
6364 1 MYSQL_YYABORT;
6365 }
6366 }
6367 ;
6368
6369 opt_num_parts:
6370 /* empty */
6371 14922 { $$= 0; }
6372 | PARTITIONS_SYM real_ulong_num
6373 {
6374
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 9545 times.
9546 if ($2 == 0)
6375 {
6376
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_NO_PARTS_ERROR, MYF(0), "partitions");
6377 1 MYSQL_YYABORT;
6378 }
6379 9545 $$= $2;
6380 }
6381 ;
6382
6383 opt_sub_part:
6384 20077 /* empty */ { $$= NULL; }
6385 | SUBPARTITION_SYM BY opt_linear HASH_SYM '(' bit_expr ')'
6386 opt_num_subparts
6387 {
6388
2/4
✓ Branch 0 taken 3459 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3459 times.
✗ Branch 3 not taken.
3459 $$= NEW_PTN PT_sub_partition_by_hash($3, @6, $6, $8);
6389 }
6390 | SUBPARTITION_SYM BY opt_linear KEY_SYM opt_key_algo
6391 '(' name_list ')' opt_num_subparts
6392 {
6393
2/4
✓ Branch 0 taken 898 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 898 times.
✗ Branch 3 not taken.
898 $$= NEW_PTN PT_sub_partition_by_key($3, $5, $7, $9);
6394 }
6395 ;
6396
6397
6398 opt_name_list:
6399 356 /* empty */ { $$= NULL; }
6400 | name_list
6401 ;
6402
6403
6404 name_list:
6405 ident
6406 {
6407
1/2
✓ Branch 0 taken 5101 times.
✗ Branch 1 not taken.
5101 $$= NEW_PTN List<char>;
6408
4/8
✓ Branch 0 taken 5101 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5101 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5101 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5101 times.
5101 if ($$ == NULL || $$->push_back($1.str))
6409 MYSQL_YYABORT;
6410 }
6411 | name_list ',' ident
6412 {
6413 588 $$= $1;
6414
2/4
✓ Branch 0 taken 588 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 588 times.
588 if ($$->push_back($3.str))
6415 MYSQL_YYABORT;
6416 }
6417 ;
6418
6419 opt_num_subparts:
6420 /* empty */
6421 2140 { $$= 0; }
6422 | SUBPARTITIONS_SYM real_ulong_num
6423 {
6424
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2217 times.
2218 if ($2 == 0)
6425 {
6426
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_NO_PARTS_ERROR, MYF(0), "subpartitions");
6427 1 MYSQL_YYABORT;
6428 }
6429 2217 $$= $2;
6430 }
6431 ;
6432
6433 opt_part_defs:
6434 10436 /* empty */ { $$= NULL; }
6435 13994 | '(' part_def_list ')' { $$= $2; }
6436 ;
6437
6438 part_def_list:
6439 part_definition
6440 {
6441
2/4
✓ Branch 0 taken 14485 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14485 times.
✗ Branch 3 not taken.
14485 $$= NEW_PTN Mem_root_array<PT_part_definition*>(YYMEM_ROOT);
6442
4/8
✓ Branch 0 taken 14485 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14485 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 14485 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 14485 times.
14485 if ($$ == NULL || $$->push_back($1))
6443 MYSQL_YYABORT; // OOM
6444 }
6445 | part_def_list ',' part_definition
6446 {
6447 31844 $$= $1;
6448
2/4
✓ Branch 0 taken 31844 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 31844 times.
31844 if ($$->push_back($3))
6449 MYSQL_YYABORT; // OOM
6450 }
6451 ;
6452
6453 part_definition:
6454 PARTITION_SYM ident opt_part_values opt_part_options opt_sub_partition
6455 {
6456 46329 $$= NEW_PTN PT_part_definition(@0, $2, $3.type, $3.values, @3,
6457
2/4
✓ Branch 0 taken 46329 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 46329 times.
✗ Branch 3 not taken.
46329 $4, $5, @5);
6458 }
6459 ;
6460
6461 opt_part_values:
6462 /* empty */
6463 {
6464 1518 $$.type= partition_type::HASH;
6465 }
6466 | VALUES LESS_SYM THAN_SYM part_func_max
6467 {
6468 31890 $$.type= partition_type::RANGE;
6469 31890 $$.values= $4;
6470 }
6471 | VALUES IN_SYM part_values_in
6472 {
6473 12921 $$.type= partition_type::LIST;
6474 12921 $$.values= $3;
6475 }
6476 ;
6477
6478 part_func_max:
6479 4488 MAX_VALUE_SYM { $$= NULL; }
6480 | part_value_item_list_paren
6481 ;
6482
6483 part_values_in:
6484 part_value_item_list_paren
6485 {
6486
2/4
✓ Branch 0 taken 12791 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12791 times.
✗ Branch 3 not taken.
12791 $$= NEW_PTN PT_part_values_in_item(@1, $1);
6487 }
6488 | '(' part_value_list ')'
6489 {
6490
2/4
✓ Branch 0 taken 130 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 130 times.
✗ Branch 3 not taken.
130 $$= NEW_PTN PT_part_values_in_list(@3, $2);
6491 }
6492 ;
6493
6494 part_value_list:
6495 part_value_item_list_paren
6496 {
6497 131 $$= NEW_PTN
6498
2/4
✓ Branch 0 taken 131 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 131 times.
✗ Branch 3 not taken.
131 Mem_root_array<PT_part_value_item_list_paren *>(YYMEM_ROOT);
6499
4/8
✓ Branch 0 taken 131 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 131 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 131 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 131 times.
131 if ($$ == NULL || $$->push_back($1))
6500 MYSQL_YYABORT; // OOM
6501 }
6502 | part_value_list ',' part_value_item_list_paren
6503 {
6504 896 $$= $1;
6505
2/4
✓ Branch 0 taken 896 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 896 times.
896 if ($$->push_back($3))
6506 MYSQL_YYABORT; // OOM
6507 }
6508 ;
6509
6510 part_value_item_list_paren:
6511 '('
6512 {
6513 /*
6514 This empty action is required because it resolves 2 reduce/reduce
6515 conflicts with an anonymous row expression:
6516
6517 simple_expr:
6518 ...
6519 | '(' expr ',' expr_list ')'
6520 */
6521 }
6522 part_value_item_list ')'
6523 {
6524
2/4
✓ Branch 0 taken 41220 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 41220 times.
✗ Branch 3 not taken.
41220 $$= NEW_PTN PT_part_value_item_list_paren($3, @4);
6525 }
6526 ;
6527
6528 part_value_item_list:
6529 part_value_item
6530 {
6531
2/4
✓ Branch 0 taken 41220 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 41220 times.
✗ Branch 3 not taken.
41220 $$= NEW_PTN Mem_root_array<PT_part_value_item *>(YYMEM_ROOT);
6532
4/8
✓ Branch 0 taken 41220 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 41220 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 41220 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 41220 times.
41220 if ($$ == NULL || $$->push_back($1))
6533 MYSQL_YYABORT; // OOM
6534 }
6535 | part_value_item_list ',' part_value_item
6536 {
6537 73633 $$= $1;
6538
2/4
✓ Branch 0 taken 73633 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 73633 times.
73633 if ($$->push_back($3))
6539 MYSQL_YYABORT; // OOM
6540 }
6541 ;
6542
6543 part_value_item:
6544
2/4
✓ Branch 0 taken 483 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 483 times.
✗ Branch 3 not taken.
483 MAX_VALUE_SYM { $$= NEW_PTN PT_part_value_item_max(@1); }
6545
2/4
✓ Branch 0 taken 114370 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 114370 times.
✗ Branch 3 not taken.
114370 | bit_expr { $$= NEW_PTN PT_part_value_item_expr(@1, $1); }
6546 ;
6547
6548
6549 opt_sub_partition:
6550 40475 /* empty */ { $$= NULL; }
6551 5854 | '(' sub_part_list ')' { $$= $2; }
6552 ;
6553
6554 sub_part_list:
6555 sub_part_definition
6556 {
6557
2/4
✓ Branch 0 taken 5854 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5854 times.
✗ Branch 3 not taken.
5854 $$= NEW_PTN Mem_root_array<PT_subpartition *>(YYMEM_ROOT);
6558
4/8
✓ Branch 0 taken 5854 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5854 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5854 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5854 times.
5854 if ($$ == NULL || $$->push_back($1))
6559 MYSQL_YYABORT; // OOM
6560 }
6561 | sub_part_list ',' sub_part_definition
6562 {
6563 7404 $$= $1;
6564
2/4
✓ Branch 0 taken 7404 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7404 times.
7404 if ($$->push_back($3))
6565 MYSQL_YYABORT; // OOM
6566 }
6567 ;
6568
6569 sub_part_definition:
6570 SUBPARTITION_SYM ident_or_text opt_part_options
6571 {
6572
2/4
✓ Branch 0 taken 13258 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13258 times.
✗ Branch 3 not taken.
13258 $$= NEW_PTN PT_subpartition(@1, $2.str, $3);
6573 }
6574 ;
6575
6576 opt_part_options:
6577 14404 /* empty */ { $$= NULL; }
6578 | part_option_list
6579 ;
6580
6581 part_option_list:
6582 part_option_list part_option
6583 {
6584 3258 $$= $1;
6585
2/4
✓ Branch 0 taken 3258 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3258 times.
3258 if ($$->push_back($2))
6586 MYSQL_YYABORT; // OOM
6587 }
6588 | part_option
6589 {
6590
2/4
✓ Branch 0 taken 45183 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 45183 times.
✗ Branch 3 not taken.
45183 $$= NEW_PTN Mem_root_array<PT_partition_option *>(YYMEM_ROOT);
6591
4/8
✓ Branch 0 taken 45183 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 45183 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 45183 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 45183 times.
45183 if ($$ == NULL || $$->push_back($1))
6592 MYSQL_YYABORT; // OOM
6593 }
6594 ;
6595
6596 part_option:
6597 TABLESPACE_SYM opt_equal ident
6598
2/4
✓ Branch 0 taken 1546 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1546 times.
✗ Branch 3 not taken.
1546 { $$= NEW_PTN PT_partition_tablespace($3.str); }
6599 | opt_storage ENGINE_SYM opt_equal ident_or_text
6600
2/4
✓ Branch 0 taken 44385 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 44385 times.
✗ Branch 3 not taken.
44385 { $$= NEW_PTN PT_partition_engine(to_lex_cstring($4)); }
6601 | NODEGROUP_SYM opt_equal real_ulong_num
6602
2/4
✓ Branch 0 taken 97 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 97 times.
✗ Branch 3 not taken.
97 { $$= NEW_PTN PT_partition_nodegroup($3); }
6603 | MAX_ROWS opt_equal real_ulonglong_num
6604
2/4
✓ Branch 0 taken 335 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 335 times.
✗ Branch 3 not taken.
335 { $$= NEW_PTN PT_partition_max_rows($3); }
6605 | MIN_ROWS opt_equal real_ulonglong_num
6606
2/4
✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 332 times.
✗ Branch 3 not taken.
332 { $$= NEW_PTN PT_partition_min_rows($3); }
6607 | DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
6608
2/4
✓ Branch 0 taken 1350 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1350 times.
✗ Branch 3 not taken.
1350 { $$= NEW_PTN PT_partition_data_directory($4.str); }
6609 | INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
6610
2/4
✓ Branch 0 taken 193 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 193 times.
✗ Branch 3 not taken.
193 { $$= NEW_PTN PT_partition_index_directory($4.str); }
6611 | COMMENT_SYM opt_equal TEXT_STRING_sys
6612
2/4
✓ Branch 0 taken 203 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 203 times.
✗ Branch 3 not taken.
203 { $$= NEW_PTN PT_partition_comment($3.str); }
6613 ;
6614
6615 /*
6616 End of partition parser part
6617 */
6618
6619 alter_database_options:
6620 alter_database_option
6621 | alter_database_options alter_database_option
6622 ;
6623
6624 alter_database_option:
6625 create_database_option
6626 | READ_SYM ONLY_SYM opt_equal ternary_option
6627 {
6628 /*
6629 If the statement has set READ ONLY already, and we repeat the
6630 READ ONLY option in the statement, the option must be set to
6631 the same value as before, otherwise, report an error.
6632 */
6633
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 244 times.
262 if ((Lex->create_info->used_fields &
6634 18 HA_CREATE_USED_READ_ONLY) &&
6635 18 (Lex->create_info->schema_read_only !=
6636
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 10 times.
18 ($4 == Ternary_option::ON))) {
6637
1/2
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
8 my_error(ER_CONFLICTING_DECLARATIONS, MYF(0), "READ ONLY", "=0",
6638 "READ ONLY", "=1");
6639 8 MYSQL_YYABORT;
6640 }
6641 254 Lex->create_info->schema_read_only = ($4 == Ternary_option::ON);
6642 254 Lex->create_info->used_fields |= HA_CREATE_USED_READ_ONLY;
6643 }
6644 ;
6645
6646 opt_create_database_options:
6647 /* empty */ {}
6648 | create_database_options {}
6649 ;
6650
6651 create_database_options:
6652 create_database_option {}
6653 | create_database_options create_database_option {}
6654 ;
6655
6656 create_database_option:
6657 default_collation
6658 {
6659
3/4
✓ Branch 0 taken 12542 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 12541 times.
12542 if (set_default_collation(Lex->create_info, $1))
6660 1 MYSQL_YYABORT;
6661 }
6662 | default_charset
6663 {
6664
3/4
✓ Branch 0 taken 2146 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 2145 times.
2146 if (set_default_charset(Lex->create_info, $1))
6665 1 MYSQL_YYABORT;
6666 }
6667 | default_encryption
6668 {
6669 // Validate if we have either 'y|Y' or 'n|N'
6670
5/6
✓ Branch 0 taken 1013 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 624 times.
✓ Branch 3 taken 389 times.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 1009 times.
1637 if (my_strcasecmp(system_charset_info, $1.str, "Y") != 0 &&
6671
3/4
✓ Branch 0 taken 624 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 620 times.
624 my_strcasecmp(system_charset_info, $1.str, "N") != 0) {
6672
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 my_error(ER_WRONG_VALUE, MYF(0), "argument (should be Y or N)", $1.str);
6673 4 MYSQL_YYABORT;
6674 }
6675
6676 1009 Lex->create_info->encrypt_type= $1;
6677 1009 Lex->create_info->used_fields |= HA_CREATE_USED_DEFAULT_ENCRYPTION;
6678 }
6679 ;
6680
6681 opt_if_not_exists:
6682 994170 /* empty */ { $$= false; }
6683 21237 | IF not EXISTS { $$= true; }
6684 ;
6685
6686 create_table_options_space_separated:
6687 create_table_option
6688 {
6689
2/4
✓ Branch 0 taken 21565 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21565 times.
✗ Branch 3 not taken.
21565 $$= NEW_PTN Mem_root_array<PT_ddl_table_option *>(YYMEM_ROOT);
6690
4/8
✓ Branch 0 taken 21565 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21565 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 21565 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 21565 times.
21565 if ($$ == NULL || $$->push_back($1))
6691 MYSQL_YYABORT; // OOM
6692 }
6693 | create_table_options_space_separated create_table_option
6694 {
6695 3573 $$= $1;
6696
2/4
✓ Branch 0 taken 3573 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3573 times.
3573 if ($$->push_back($2))
6697 MYSQL_YYABORT; // OOM
6698 }
6699 ;
6700
6701 create_table_options:
6702 create_table_option
6703 {
6704
2/4
✓ Branch 0 taken 555959 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 555959 times.
✗ Branch 3 not taken.
555959 $$= NEW_PTN Mem_root_array<PT_create_table_option *>(YYMEM_ROOT);
6705
4/8
✓ Branch 0 taken 555959 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 555957 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 555957 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 555957 times.
555959 if ($$ == NULL || $$->push_back($1))
6706 MYSQL_YYABORT; // OOM
6707 }
6708 | create_table_options opt_comma create_table_option
6709 {
6710 2158595 $$= $1;
6711
2/4
✓ Branch 0 taken 2158595 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2158595 times.
2158595 if ($$->push_back($3))
6712 MYSQL_YYABORT; // OOM
6713 }
6714 ;
6715
6716 opt_comma:
6717 /* empty */
6718 | ','
6719 ;
6720
6721 create_table_option:
6722 ENGINE_SYM opt_equal ident_or_text
6723 {
6724
2/4
✓ Branch 0 taken 554738 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 554738 times.
✗ Branch 3 not taken.
554738 $$= NEW_PTN PT_create_table_engine_option(to_lex_cstring($3));
6725 }
6726 | SECONDARY_ENGINE_SYM opt_equal NULL_SYM
6727 {
6728
1/2
✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
60 $$= NEW_PTN PT_create_table_secondary_engine_option();
6729 }
6730 | SECONDARY_ENGINE_SYM opt_equal ident_or_text
6731 {
6732
2/4
✓ Branch 0 taken 114 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 114 times.
✗ Branch 3 not taken.
114 $$= NEW_PTN PT_create_table_secondary_engine_option(to_lex_cstring($3));
6733 }
6734 | MAX_ROWS opt_equal ulonglong_num
6735 {
6736
2/4
✓ Branch 0 taken 56 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 56 times.
✗ Branch 3 not taken.
56 $$= NEW_PTN PT_create_max_rows_option($3);
6737 }
6738 | MIN_ROWS opt_equal ulonglong_num
6739 {
6740
2/4
✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29 times.
✗ Branch 3 not taken.
29 $$= NEW_PTN PT_create_min_rows_option($3);
6741 }
6742 | AVG_ROW_LENGTH opt_equal ulonglong_num
6743 {
6744 // The frm-format only allocated 4 bytes for avg_row_length, and
6745 // there is code which assumes it can be represented as an uint,
6746 // so we constrain it here.
6747
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 24 times.
26 if ($3 > std::numeric_limits<std::uint32_t>::max()) {
6748
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 YYTHD->syntax_error_at(@3,
6749 "The valid range for avg_row_length is [0,4294967295]. Error"
6750 );
6751 2 MYSQL_YYABORT;
6752 }
6753
2/4
✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
24 $$= NEW_PTN PT_create_avg_row_length_option($3);
6754 }
6755 | PASSWORD opt_equal TEXT_STRING_sys
6756 {
6757
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
6 $$= NEW_PTN PT_create_password_option($3.str);
6758 }
6759 | COMMENT_SYM opt_equal TEXT_STRING_sys
6760 {
6761
2/4
✓ Branch 0 taken 16417 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16417 times.
✗ Branch 3 not taken.
16417 $$= NEW_PTN PT_create_commen_option($3);
6762 }
6763 | COMPRESSION_SYM opt_equal TEXT_STRING_sys
6764 {
6765
2/4
✓ Branch 0 taken 264 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 264 times.
✗ Branch 3 not taken.
264 $$= NEW_PTN PT_create_compress_option($3);
6766 }
6767 | ENCRYPTION_SYM opt_equal TEXT_STRING_sys
6768 {
6769
2/4
✓ Branch 0 taken 26944 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 26944 times.
✗ Branch 3 not taken.
26944 $$= NEW_PTN PT_create_encryption_option($3);
6770 }
6771 | ENCRYPTION_KEY_ID_SYM opt_equal real_ulong_num
6772 {
6773
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 3 times.
5 if ($3 >= UINT_MAX32)
6774 {
6775
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_ENCRYPTION_KEY_ID_VALUE_OUT_OF_RANGE, MYF(0), $3,
6776 UINT_MAX32 - 1);
6777 2 MYSQL_YYABORT;
6778 }
6779
6780
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 $$= NEW_PTN PT_create_encryption_key_id_option($3);
6781 }
6782 | AUTO_INC opt_equal ulonglong_num
6783 {
6784
2/4
✓ Branch 0 taken 650 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
✗ Branch 3 not taken.
650 $$= NEW_PTN PT_create_auto_increment_option($3);
6785 }
6786 | PACK_KEYS_SYM opt_equal ternary_option
6787 {
6788
2/4
✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 57 times.
✗ Branch 3 not taken.
57 $$= NEW_PTN PT_create_pack_keys_option($3);
6789 }
6790 | STATS_AUTO_RECALC_SYM opt_equal ternary_option
6791 {
6792
2/4
✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
✗ Branch 3 not taken.
20 $$= NEW_PTN PT_create_stats_auto_recalc_option($3);
6793 }
6794 | STATS_PERSISTENT_SYM opt_equal ternary_option
6795 {
6796
2/4
✓ Branch 0 taken 427212 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427212 times.
✗ Branch 3 not taken.
427212 $$= NEW_PTN PT_create_stats_persistent_option($3);
6797 }
6798 | STATS_SAMPLE_PAGES_SYM opt_equal ulong_num
6799 {
6800 /* From user point of view STATS_SAMPLE_PAGES can be specified as
6801 STATS_SAMPLE_PAGES=N (where 0<N<=65535, it does not make sense to
6802 scan 0 pages) or STATS_SAMPLE_PAGES=default. Internally we record
6803 =default as 0. See create_frm() in sql/table.cc, we use only two
6804 bytes for stats_sample_pages and this is why we do not allow
6805 larger values. 65535 pages, 16kb each means to sample 1GB, which
6806 is impractical. If at some point this needs to be extended, then
6807 we can store the higher bits from stats_sample_pages in .frm too. */
6808
4/4
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 5 times.
9 if ($3 == 0 || $3 > 0xffff)
6809 {
6810
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 YYTHD->syntax_error_at(@3,
6811 "The valid range for stats_sample_pages is [1, 65535]. Error");
6812 4 MYSQL_YYABORT;
6813 }
6814
2/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
5 $$= NEW_PTN PT_create_stats_stable_pages($3);
6815 }
6816 | STATS_SAMPLE_PAGES_SYM opt_equal DEFAULT_SYM
6817 {
6818
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 $$= NEW_PTN PT_create_stats_stable_pages;
6819 }
6820 | CHECKSUM_SYM opt_equal ulong_num
6821 {
6822
2/4
✓ Branch 0 taken 39 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
✗ Branch 3 not taken.
39 $$= NEW_PTN PT_create_checksum_option($3);
6823 }
6824 | TABLE_CHECKSUM_SYM opt_equal ulong_num
6825 {
6826 $$= NEW_PTN PT_create_checksum_option($3);
6827 }
6828 | DELAY_KEY_WRITE_SYM opt_equal ulong_num
6829 {
6830
2/4
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
✗ Branch 3 not taken.
25 $$= NEW_PTN PT_create_delay_key_write_option($3);
6831 }
6832 | ROW_FORMAT_SYM opt_equal row_types
6833 {
6834
2/4
✓ Branch 0 taken 428962 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 428962 times.
✗ Branch 3 not taken.
428962 $$= NEW_PTN PT_create_row_format_option($3);
6835 }
6836 | UNION_SYM opt_equal '(' opt_table_list ')'
6837 {
6838
2/4
✓ Branch 0 taken 96 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 96 times.
✗ Branch 3 not taken.
96 $$= NEW_PTN PT_create_union_option($4);
6839 }
6840 | default_charset
6841 {
6842
2/4
✓ Branch 0 taken 434680 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 434680 times.
✗ Branch 3 not taken.
434680 $$= NEW_PTN PT_create_table_default_charset($1);
6843 }
6844 | default_collation
6845 {
6846
2/4
✓ Branch 0 taken 418005 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 418005 times.
✗ Branch 3 not taken.
418005 $$= NEW_PTN PT_create_table_default_collation($1);
6847 }
6848 | INSERT_METHOD opt_equal merge_insert_types
6849 {
6850
2/4
✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✗ Branch 3 not taken.
69 $$= NEW_PTN PT_create_insert_method_option($3);
6851 }
6852 | DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
6853 {
6854
2/4
✓ Branch 0 taken 176 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 176 times.
✗ Branch 3 not taken.
176 $$= NEW_PTN PT_create_data_directory_option($4.str);
6855 }
6856 | INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
6857 {
6858
2/4
✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 27 times.
✗ Branch 3 not taken.
27 $$= NEW_PTN PT_create_index_directory_option($4.str);
6859 }
6860 | TABLESPACE_SYM opt_equal ident
6861 {
6862
2/4
✓ Branch 0 taken 430116 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 430116 times.
✗ Branch 3 not taken.
430116 $$= NEW_PTN PT_create_tablespace_option($3.str);
6863 }
6864 | STORAGE_SYM DISK_SYM
6865 {
6866
2/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
5 $$= NEW_PTN PT_create_storage_option(HA_SM_DISK);
6867 }
6868 | STORAGE_SYM MEMORY_SYM
6869 {
6870
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 $$= NEW_PTN PT_create_storage_option(HA_SM_MEMORY);
6871 }
6872 | CONNECTION_SYM opt_equal TEXT_STRING_sys
6873 {
6874
2/4
✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 81 times.
✗ Branch 3 not taken.
81 $$= NEW_PTN PT_create_connection_option($3);
6875 }
6876 | KEY_BLOCK_SIZE opt_equal ulonglong_num
6877 {
6878 // The frm-format only allocated 2 bytes for key_block_size,
6879 // even if it is represented as std::uint32_t in HA_CREATE_INFO and
6880 // elsewhere.
6881
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 570 times.
575 if ($3 > std::numeric_limits<std::uint16_t>::max()) {
6882
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 YYTHD->syntax_error_at(@3,
6883 "The valid range for key_block_size is [0,65535]. Error");
6884 5 MYSQL_YYABORT;
6885 }
6886
6887
1/2
✓ Branch 0 taken 570 times.
✗ Branch 1 not taken.
1140 $$= NEW_PTN
6888
1/2
✓ Branch 0 taken 570 times.
✗ Branch 1 not taken.
1140 PT_create_key_block_size_option(static_cast<std::uint32_t>($3));
6889 }
6890 | START_SYM TRANSACTION_SYM
6891 {
6892
2/4
✓ Branch 0 taken 73 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 73 times.
✗ Branch 3 not taken.
73 $$= NEW_PTN PT_create_start_transaction_option(true);
6893 }
6894 | ENGINE_ATTRIBUTE_SYM opt_equal json_attribute
6895 {
6896
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
26 $$ = make_table_engine_attribute(YYMEM_ROOT, $3);
6897 }
6898 | SECONDARY_ENGINE_ATTRIBUTE_SYM opt_equal json_attribute
6899 {
6900
1/2
✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
27 $$ = make_table_secondary_engine_attribute(YYMEM_ROOT, $3);
6901 }
6902 | option_autoextend_size
6903 {
6904
2/4
✓ Branch 0 taken 135 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 135 times.
✗ Branch 3 not taken.
135 $$ = NEW_PTN PT_create_ts_autoextend_size_option($1);
6905 }
6906 ;
6907
6908 ternary_option:
6909 ulong_num
6910 {
6911
3/3
✓ Branch 0 taken 427299 times.
✓ Branch 1 taken 221 times.
✓ Branch 2 taken 2 times.
427522 switch($1) {
6912 427299 case 0:
6913 427299 $$= Ternary_option::OFF;
6914 427299 break;
6915 221 case 1:
6916 221 $$= Ternary_option::ON;
6917 221 break;
6918 2 default:
6919
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 YYTHD->syntax_error();
6920 2 MYSQL_YYABORT;
6921 }
6922 }
6923 31 | DEFAULT_SYM { $$= Ternary_option::DEFAULT; }
6924 ;
6925
6926 default_charset:
6927 436826 opt_default character_set opt_equal charset_name { $$ = $4; }
6928 ;
6929
6930 default_collation:
6931 430547 opt_default COLLATE_SYM opt_equal collation_name { $$ = $4;}
6932 ;
6933
6934 default_encryption:
6935 1013 opt_default ENCRYPTION_SYM opt_equal TEXT_STRING_sys { $$ = $4;}
6936 ;
6937
6938 row_types:
6939 29 DEFAULT_SYM { $$= ROW_TYPE_DEFAULT; }
6940 25 | FIXED_SYM { $$= ROW_TYPE_FIXED; }
6941 427772 | DYNAMIC_SYM { $$= ROW_TYPE_DYNAMIC; }
6942 550 | COMPRESSED_SYM { $$= ROW_TYPE_COMPRESSED; }
6943 274 | REDUNDANT_SYM { $$= ROW_TYPE_REDUNDANT; }
6944 312 | COMPACT_SYM { $$= ROW_TYPE_COMPACT; }
6945 ;
6946
6947 merge_insert_types:
6948 3 NO_SYM { $$= MERGE_INSERT_DISABLED; }
6949 21 | FIRST_SYM { $$= MERGE_INSERT_TO_FIRST; }
6950 45 | LAST_SYM { $$= MERGE_INSERT_TO_LAST; }
6951 ;
6952
6953 udf_type:
6954 284 STRING_SYM {$$ = (int) STRING_RESULT; }
6955 17 | REAL_SYM {$$ = (int) REAL_RESULT; }
6956 | DECIMAL_SYM {$$ = (int) DECIMAL_RESULT; }
6957 374 | INT_SYM {$$ = (int) INT_RESULT; }
6958 ;
6959
6960 table_element_list:
6961 table_element
6962 {
6963
2/4
✓ Branch 0 taken 668332 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 668331 times.
✗ Branch 3 not taken.
668333 $$= NEW_PTN Mem_root_array<PT_table_element *>(YYMEM_ROOT);
6964
4/8
✓ Branch 0 taken 668331 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 668331 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 668331 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 668331 times.
668331 if ($$ == NULL || $$->push_back($1))
6965 MYSQL_YYABORT; // OOM
6966 }
6967 | table_element_list ',' table_element
6968 {
6969 6718035 $$= $1;
6970
2/4
✓ Branch 0 taken 6718035 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6718035 times.
6718035 if ($$->push_back($3))
6971 MYSQL_YYABORT; // OOM
6972 }
6973 ;
6974
6975 table_element:
6976 5441410 column_def { $$= $1; }
6977 1944959 | table_constraint_def { $$= $1; }
6978 ;
6979
6980 column_def:
6981 ident field_def opt_references
6982 {
6983
2/4
✓ Branch 0 taken 5441407 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5441406 times.
✗ Branch 3 not taken.
5441408 $$= NEW_PTN PT_column_def($1, $2, $3);
6984 }
6985 ;
6986
6987 opt_references:
6988 5471765 /* empty */ { $$= NULL; }
6989 | references
6990 {
6991 /* Currently we ignore FK references here: */
6992 9 $$= NULL;
6993 }
6994 ;
6995
6996 table_constraint_def:
6997 key_or_index opt_index_name_and_type '(' key_list_with_expression ')'
6998 opt_index_options
6999 {
7000
1/2
✓ Branch 0 taken 484688 times.
✗ Branch 1 not taken.
969376 $$= NEW_PTN PT_inline_index_definition(KEYTYPE_MULTIPLE,
7001
1/2
✓ Branch 0 taken 484688 times.
✗ Branch 1 not taken.
1454064 $2.name, $2.type, $4, $6);
7002 }
7003 | FULLTEXT_SYM opt_key_or_index opt_ident '(' key_list_with_expression ')'
7004 opt_fulltext_index_options
7005 {
7006
1/2
✓ Branch 0 taken 1197 times.
✗ Branch 1 not taken.
2394 $$= NEW_PTN PT_inline_index_definition(KEYTYPE_FULLTEXT, $3, NULL,
7007
1/2
✓ Branch 0 taken 1197 times.
✗ Branch 1 not taken.
3591 $5, $7);
7008 }
7009 | SPATIAL_SYM opt_key_or_index opt_ident '(' key_list_with_expression ')'
7010 opt_spatial_index_options
7011 {
7012
2/4
✓ Branch 0 taken 1336 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1336 times.
✗ Branch 3 not taken.
1336 $$= NEW_PTN PT_inline_index_definition(KEYTYPE_SPATIAL, $3, NULL, $5, $7);
7013 }
7014 | opt_constraint_name constraint_key_type opt_index_name_and_type
7015 '(' key_list_with_expression ')' opt_index_options
7016 {
7017
2/2
✓ Branch 0 taken 363 times.
✓ Branch 1 taken 851340 times.
851703 if (($1.length != 0)
7018
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 361 times.
363 && ($2 == (KEYTYPE_CLUSTERING | KEYTYPE_MULTIPLE)))
7019 {
7020 /* Forbid "CONSTRAINT c CLUSTERING" */
7021
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SYNTAX_ERROR, MYF(0));
7022 2 MYSQL_YYABORT;
7023 }
7024 /*
7025 Constraint-implementing indexes are named by the constraint type
7026 by default.
7027 */
7028
2/2
✓ Branch 0 taken 35857 times.
✓ Branch 1 taken 815844 times.
851701 LEX_STRING name= $3.name.str != NULL ? $3.name : $1;
7029
2/4
✓ Branch 0 taken 851701 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 851701 times.
✗ Branch 3 not taken.
851701 $$= NEW_PTN PT_inline_index_definition($2, name, $3.type, $5, $7);
7030 }
7031 | opt_constraint_name FOREIGN KEY_SYM opt_ident '(' key_list ')' references
7032 {
7033
1/2
✓ Branch 0 taken 612909 times.
✗ Branch 1 not taken.
1225818 $$= NEW_PTN PT_foreign_key_definition($1, $4, $6, $8.table_name,
7034 $8.reference_list,
7035 $8.fk_match_option,
7036 $8.fk_update_opt,
7037
1/2
✓ Branch 0 taken 612909 times.
✗ Branch 1 not taken.
1225818 $8.fk_delete_opt);
7038 }
7039 | opt_constraint_name check_constraint opt_constraint_enforcement
7040 {
7041
2/4
✓ Branch 0 taken 789 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 789 times.
✗ Branch 3 not taken.
789 $$= NEW_PTN PT_check_constraint($1, $2, $3);
7042
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 789 times.
789 if ($$ == nullptr) MYSQL_YYABORT; // OOM
7043 }
7044 ;
7045
7046 check_constraint:
7047 1007 CHECK_SYM '(' expr ')' { $$= $3; }
7048 ;
7049
7050 opt_constraint_name:
7051 1463641 /* empty */ { $$= NULL_STR; }
7052 2015 | CONSTRAINT opt_ident { $$= $2; }
7053 ;
7054
7055 opt_not:
7056 180 /* empty */ { $$= false; }
7057 598 | NOT_SYM { $$= true; }
7058 ;
7059
7060 opt_constraint_enforcement:
7061 199 /* empty */ { $$= true; }
7062 590 | constraint_enforcement { $$= $1; }
7063 ;
7064
7065 constraint_enforcement:
7066 776 opt_not ENFORCED_SYM { $$= !($1); }
7067 ;
7068
7069 field_def:
7070 type opt_column_attribute_list
7071 {
7072
2/4
✓ Branch 0 taken 5494798 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5494800 times.
✗ Branch 3 not taken.
5494799 $$= NEW_PTN PT_field_def($1, $2);
7073 }
7074 | type opt_collate opt_generated_always
7075 AS '(' expr ')'
7076 opt_stored_attribute opt_column_attribute_list
7077 {
7078 7314 auto *opt_attrs= $9;
7079
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 7311 times.
7314 if ($2 != NULL)
7080 {
7081
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 if (opt_attrs == NULL)
7082 {
7083 opt_attrs= NEW_PTN
7084 Mem_root_array<PT_column_attr_base *>(YYMEM_ROOT);
7085 }
7086
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 auto *collation= NEW_PTN PT_collate_column_attr(@2, $2);
7087
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
6 if (opt_attrs == nullptr || collation == nullptr ||
7088
3/6
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 3 times.
6 opt_attrs->push_back(collation))
7089 MYSQL_YYABORT; // OOM
7090 }
7091
2/4
✓ Branch 0 taken 7314 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7314 times.
✗ Branch 3 not taken.
7314 $$= NEW_PTN PT_generated_field_def($1, $6, $8, opt_attrs);
7092 }
7093 ;
7094
7095 opt_generated_always:
7096 /* empty */
7097 | GENERATED ALWAYS_SYM
7098 ;
7099
7100 opt_stored_attribute:
7101 933 /* empty */ { $$= Virtual_or_stored::VIRTUAL; }
7102 4276 | VIRTUAL_SYM { $$= Virtual_or_stored::VIRTUAL; }
7103 2105 | STORED_SYM { $$= Virtual_or_stored::STORED; }
7104 ;
7105
7106 type:
7107 int_type opt_field_length field_options
7108 {
7109
2/4
✓ Branch 0 taken 2440642 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2440641 times.
✗ Branch 3 not taken.
2440642 $$= NEW_PTN PT_numeric_type(YYTHD, $1, $2, $3);
7110 }
7111 | real_type opt_precision field_options
7112 {
7113
2/4
✓ Branch 0 taken 5869 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5869 times.
✗ Branch 3 not taken.
5869 $$= NEW_PTN PT_numeric_type(YYTHD, $1, $2.length, $2.dec, $3);
7114 }
7115 | numeric_type float_options field_options
7116 {
7117
2/4
✓ Branch 0 taken 18787 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18787 times.
✗ Branch 3 not taken.
18787 $$= NEW_PTN PT_numeric_type(YYTHD, $1, $2.length, $2.dec, $3);
7118 }
7119 | BIT_SYM %prec KEYWORD_USED_AS_KEYWORD
7120 {
7121
2/4
✓ Branch 0 taken 953 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 953 times.
✗ Branch 3 not taken.
953 $$= NEW_PTN PT_bit_type;
7122 }
7123 | BIT_SYM field_length
7124 {
7125
2/4
✓ Branch 0 taken 1227 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1227 times.
✗ Branch 3 not taken.
1227 $$= NEW_PTN PT_bit_type($2);
7126 }
7127 | BOOL_SYM
7128 {
7129
2/4
✓ Branch 0 taken 230243 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 230243 times.
✗ Branch 3 not taken.
230243 $$= NEW_PTN PT_boolean_type;
7130 }
7131 | BOOLEAN_SYM
7132 {
7133
2/4
✓ Branch 0 taken 28755 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28755 times.
✗ Branch 3 not taken.
28755 $$= NEW_PTN PT_boolean_type;
7134 }
7135 | CHAR_SYM field_length opt_charset_with_opt_binary
7136 {
7137
1/2
✓ Branch 0 taken 106265 times.
✗ Branch 1 not taken.
212530 $$= NEW_PTN PT_char_type(Char_type::CHAR, $2, $3.charset,
7138
1/2
✓ Branch 0 taken 106265 times.
✗ Branch 1 not taken.
212530 $3.force_binary);
7139 }
7140 | CHAR_SYM opt_charset_with_opt_binary
7141 {
7142
1/2
✓ Branch 0 taken 703 times.
✗ Branch 1 not taken.
1406 $$= NEW_PTN PT_char_type(Char_type::CHAR, $2.charset,
7143
1/2
✓ Branch 0 taken 703 times.
✗ Branch 1 not taken.
1406 $2.force_binary);
7144 }
7145 | nchar field_length opt_bin_mod
7146 {
7147
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 29 times.
29 const CHARSET_INFO *cs= $3 ?
7148 get_bin_collation(national_charset_info) : national_charset_info;
7149
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 29 times.
29 if (cs == NULL)
7150 MYSQL_YYABORT;
7151
2/4
✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29 times.
✗ Branch 3 not taken.
29 $$= NEW_PTN PT_char_type(Char_type::CHAR, $2, cs);
7152
1/2
✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
29 warn_about_deprecated_national(YYTHD);
7153 }
7154 | nchar opt_bin_mod
7155 {
7156
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
10 const CHARSET_INFO *cs= $2 ?
7157 get_bin_collation(national_charset_info) : national_charset_info;
7158
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
10 if (cs == NULL)
7159 MYSQL_YYABORT;
7160
2/4
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
10 $$= NEW_PTN PT_char_type(Char_type::CHAR, cs);
7161
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 warn_about_deprecated_national(YYTHD);
7162 }
7163 | BINARY_SYM field_length
7164 {
7165
2/4
✓ Branch 0 taken 2621 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2621 times.
✗ Branch 3 not taken.
2621 $$= NEW_PTN PT_char_type(Char_type::CHAR, $2, &my_charset_bin);
7166 }
7167 | BINARY_SYM
7168 {
7169
2/4
✓ Branch 0 taken 67 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 67 times.
✗ Branch 3 not taken.
67 $$= NEW_PTN PT_char_type(Char_type::CHAR, &my_charset_bin);
7170 }
7171 | varchar field_length opt_charset_with_opt_binary
7172 {
7173
1/2
✓ Branch 0 taken 1230406 times.
✗ Branch 1 not taken.
2460812 $$= NEW_PTN PT_char_type(Char_type::VARCHAR, $2, $3.charset,
7174
1/2
✓ Branch 0 taken 1230406 times.
✗ Branch 1 not taken.
2460812 $3.force_binary);
7175 }
7176 | nvarchar field_length opt_bin_mod
7177 {
7178
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 33 times.
33 const CHARSET_INFO *cs= $3 ?
7179 get_bin_collation(national_charset_info) : national_charset_info;
7180
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 33 times.
33 if (cs == NULL)
7181 MYSQL_YYABORT;
7182
2/4
✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 33 times.
✗ Branch 3 not taken.
33 $$= NEW_PTN PT_char_type(Char_type::VARCHAR, $2, cs);
7183
1/2
✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
33 warn_about_deprecated_national(YYTHD);
7184 }
7185 | VARBINARY_SYM field_length
7186 {
7187
2/4
✓ Branch 0 taken 27330 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 27330 times.
✗ Branch 3 not taken.
27330 $$= NEW_PTN PT_char_type(Char_type::VARCHAR, $2, &my_charset_bin);
7188 }
7189 | YEAR_SYM opt_field_length field_options
7190 {
7191
2/2
✓ Branch 0 taken 117 times.
✓ Branch 1 taken 1479 times.
1596 if ($2)
7192 {
7193 117 errno= 0;
7194 117 ulong length= strtoul($2, NULL, 10);
7195
4/4
✓ Branch 0 taken 116 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 58 times.
✓ Branch 3 taken 58 times.
117 if (errno != 0 || length != 4)
7196 {
7197 /* Only support length is 4 */
7198
1/2
✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
59 my_error(ER_INVALID_YEAR_COLUMN_LENGTH, MYF(0), "YEAR");
7199 59 MYSQL_YYABORT;
7200 }
7201
1/2
✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
58 push_deprecated_warn(YYTHD, "YEAR(4)", "YEAR");
7202 }
7203
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1536 times.
1537 if ($3 == UNSIGNED_FLAG)
7204 {
7205
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 push_warning(YYTHD, Sql_condition::SL_WARNING,
7206 ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,
7207 ER_THD(YYTHD, ER_WARN_DEPRECATED_YEAR_UNSIGNED));
7208 }
7209 // We can ignore field length and UNSIGNED/ZEROFILL attributes here.
7210
2/4
✓ Branch 0 taken 1537 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1537 times.
✗ Branch 3 not taken.
1537 $$= NEW_PTN PT_year_type;
7211 }
7212 | DATE_SYM
7213 {
7214
2/4
✓ Branch 0 taken 3128 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3128 times.
✗ Branch 3 not taken.
3128 $$= NEW_PTN PT_date_type;
7215 }
7216 | TIME_SYM type_datetime_precision
7217 {
7218
2/4
✓ Branch 0 taken 3482 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3482 times.
✗ Branch 3 not taken.
3482 $$= NEW_PTN PT_time_type(Time_type::TIME, $2);
7219 }
7220 | TIMESTAMP_SYM type_datetime_precision
7221 {
7222
2/4
✓ Branch 0 taken 274052 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 274052 times.
✗ Branch 3 not taken.
274052 $$= NEW_PTN PT_timestamp_type($2);
7223 }
7224 | DATETIME_SYM type_datetime_precision
7225 {
7226
2/4
✓ Branch 0 taken 51060 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 51060 times.
✗ Branch 3 not taken.
51060 $$= NEW_PTN PT_time_type(Time_type::DATETIME, $2);
7227 }
7228 | TINYBLOB_SYM
7229 {
7230
2/4
✓ Branch 0 taken 734 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 734 times.
✗ Branch 3 not taken.
734 $$= NEW_PTN PT_blob_type(Blob_type::TINY, &my_charset_bin);
7231 }
7232 | BLOB_SYM opt_field_length
7233 {
7234
2/4
✓ Branch 0 taken 61828 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 61828 times.
✗ Branch 3 not taken.
61828 $$= NEW_PTN PT_blob_type($2);
7235 }
7236 | spatial_type
7237 | MEDIUMBLOB_SYM
7238 {
7239
2/4
✓ Branch 0 taken 14040 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14040 times.
✗ Branch 3 not taken.
14040 $$= NEW_PTN PT_blob_type(Blob_type::MEDIUM, &my_charset_bin);
7240 }
7241 | LONGBLOB_SYM
7242 {
7243
2/4
✓ Branch 0 taken 74006 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 74006 times.
✗ Branch 3 not taken.
74006 $$= NEW_PTN PT_blob_type(Blob_type::LONG, &my_charset_bin);
7244 }
7245 | LONG_SYM VARBINARY_SYM
7246 {
7247
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 $$= NEW_PTN PT_blob_type(Blob_type::MEDIUM, &my_charset_bin);
7248 }
7249 | LONG_SYM varchar opt_charset_with_opt_binary
7250 {
7251
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
12 $$= NEW_PTN PT_blob_type(Blob_type::MEDIUM, $3.charset,
7252
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
12 $3.force_binary);
7253 }
7254 | TINYTEXT_SYN opt_charset_with_opt_binary
7255 {
7256
1/2
✓ Branch 0 taken 834 times.
✗ Branch 1 not taken.
1668 $$= NEW_PTN PT_blob_type(Blob_type::TINY, $2.charset,
7257
1/2
✓ Branch 0 taken 834 times.
✗ Branch 1 not taken.
1668 $2.force_binary);
7258 }
7259 | TEXT_SYM opt_field_length opt_charset_with_opt_binary
7260 {
7261
1/2
✓ Branch 0 taken 124755 times.
✗ Branch 1 not taken.
249510 $$= NEW_PTN PT_char_type(Char_type::TEXT, $2, $3.charset,
7262
1/2
✓ Branch 0 taken 124755 times.
✗ Branch 1 not taken.
249510 $3.force_binary);
7263 }
7264 | MEDIUMTEXT_SYM opt_charset_with_opt_binary
7265 {
7266
1/2
✓ Branch 0 taken 351046 times.
✗ Branch 1 not taken.
702092 $$= NEW_PTN PT_blob_type(Blob_type::MEDIUM, $2.charset,
7267
1/2
✓ Branch 0 taken 351046 times.
✗ Branch 1 not taken.
702092 $2.force_binary);
7268 }
7269 | LONGTEXT_SYM opt_charset_with_opt_binary
7270 {
7271
1/2
✓ Branch 0 taken 148533 times.
✗ Branch 1 not taken.
297066 $$= NEW_PTN PT_blob_type(Blob_type::LONG, $2.charset,
7272
1/2
✓ Branch 0 taken 148533 times.
✗ Branch 1 not taken.
297066 $2.force_binary);
7273 }
7274 | ENUM_SYM '(' string_list ')' opt_charset_with_opt_binary
7275 {
7276
2/4
✓ Branch 0 taken 514818 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 514818 times.
✗ Branch 3 not taken.
514818 $$= NEW_PTN PT_enum_type($3, $5.charset, $5.force_binary);
7277 }
7278 | SET_SYM '(' string_list ')' opt_charset_with_opt_binary
7279 {
7280
2/4
✓ Branch 0 taken 50854 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 50854 times.
✗ Branch 3 not taken.
50854 $$= NEW_PTN PT_set_type($3, $5.charset, $5.force_binary);
7281 }
7282 | LONG_SYM opt_charset_with_opt_binary
7283 {
7284
1/2
✓ Branch 0 taken 108 times.
✗ Branch 1 not taken.
216 $$= NEW_PTN PT_blob_type(Blob_type::MEDIUM, $2.charset,
7285
1/2
✓ Branch 0 taken 108 times.
✗ Branch 1 not taken.
216 $2.force_binary);
7286 }
7287 | SERIAL_SYM
7288 {
7289
2/4
✓ Branch 0 taken 87 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 87 times.
✗ Branch 3 not taken.
87 $$= NEW_PTN PT_serial_type;
7290 }
7291 | JSON_SYM
7292 {
7293
2/4
✓ Branch 0 taken 102641 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 102641 times.
✗ Branch 3 not taken.
102641 $$= NEW_PTN PT_json_type;
7294 }
7295 ;
7296
7297 spatial_type:
7298 GEOMETRY_SYM
7299
2/4
✓ Branch 0 taken 530 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 530 times.
✗ Branch 3 not taken.
530 { $$= NEW_PTN PT_spacial_type(Field::GEOM_GEOMETRY); }
7300 | GEOMETRYCOLLECTION_SYM
7301
2/4
✓ Branch 0 taken 47 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 47 times.
✗ Branch 3 not taken.
47 { $$= NEW_PTN PT_spacial_type(Field::GEOM_GEOMETRYCOLLECTION); }
7302 | POINT_SYM
7303
2/4
✓ Branch 0 taken 1333 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1333 times.
✗ Branch 3 not taken.
1333 { $$= NEW_PTN PT_spacial_type(Field::GEOM_POINT); }
7304 | MULTIPOINT_SYM
7305
2/4
✓ Branch 0 taken 42 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 42 times.
✗ Branch 3 not taken.
42 { $$= NEW_PTN PT_spacial_type(Field::GEOM_MULTIPOINT); }
7306 | LINESTRING_SYM
7307
2/4
✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
82 { $$= NEW_PTN PT_spacial_type(Field::GEOM_LINESTRING); }
7308 | MULTILINESTRING_SYM
7309
2/4
✓ Branch 0 taken 39 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
✗ Branch 3 not taken.
39 { $$= NEW_PTN PT_spacial_type(Field::GEOM_MULTILINESTRING); }
7310 | POLYGON_SYM
7311
2/4
✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 72 times.
✗ Branch 3 not taken.
72 { $$= NEW_PTN PT_spacial_type(Field::GEOM_POLYGON); }
7312 | MULTIPOLYGON_SYM
7313
2/4
✓ Branch 0 taken 47 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 47 times.
✗ Branch 3 not taken.
47 { $$= NEW_PTN PT_spacial_type(Field::GEOM_MULTIPOLYGON); }
7314 ;
7315
7316 nchar:
7317 NCHAR_SYM {}
7318 | NATIONAL_SYM CHAR_SYM {}
7319 ;
7320
7321 varchar:
7322 CHAR_SYM VARYING {}
7323 | VARCHAR_SYM {}
7324 ;
7325
7326 nvarchar:
7327 NATIONAL_SYM VARCHAR_SYM {}
7328 | NVARCHAR_SYM {}
7329 | NCHAR_SYM VARCHAR_SYM {}
7330 | NATIONAL_SYM CHAR_SYM VARYING {}
7331 | NCHAR_SYM VARYING {}
7332 ;
7333
7334 int_type:
7335 747726 INT_SYM { $$=Int_type::INT; }
7336 38626 | TINYINT_SYM { $$=Int_type::TINYINT; }
7337 33619 | SMALLINT_SYM { $$=Int_type::SMALLINT; }
7338 6104 | MEDIUMINT_SYM { $$=Int_type::MEDIUMINT; }
7339 1614569 | BIGINT_SYM { $$=Int_type::BIGINT; }
7340 ;
7341
7342 real_type:
7343 REAL_SYM
7344 {
7345
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1292 times.
1293 $$= YYTHD->variables.sql_mode & MODE_REAL_AS_FLOAT ?
7346 Numeric_type::FLOAT : Numeric_type::DOUBLE;
7347 }
7348 | DOUBLE_SYM opt_PRECISION
7349 4708 { $$= Numeric_type::DOUBLE; }
7350 ;
7351
7352 opt_PRECISION:
7353 /* empty */
7354 | PRECISION
7355 ;
7356
7357 numeric_type:
7358 5758 FLOAT_SYM { $$= Numeric_type::FLOAT; }
7359 9995 | DECIMAL_SYM { $$= Numeric_type::DECIMAL; }
7360 2246 | NUMERIC_SYM { $$= Numeric_type::DECIMAL; }
7361 791 | FIXED_SYM { $$= Numeric_type::DECIMAL; }
7362 ;
7363
7364 standard_float_options:
7365 /* empty */
7366 {
7367 60 $$.length = nullptr;
7368 60 $$.dec = nullptr;
7369 }
7370 | field_length
7371 {
7372 5 $$.length = $1;
7373 5 $$.dec = nullptr;
7374 }
7375 ;
7376
7377 float_options:
7378 /* empty */
7379 {
7380 8270 $$.length= NULL;
7381 8270 $$.dec= NULL;
7382 }
7383 | field_length
7384 {
7385 1000 $$.length= $1;
7386 1000 $$.dec= NULL;
7387 }
7388 | precision
7389 ;
7390
7391 precision:
7392 '(' NUM ',' NUM ')'
7393 {
7394 11753 $$.length= $2.str;
7395 11753 $$.dec= $4.str;
7396 }
7397 ;
7398
7399
7400 type_datetime_precision:
7401 275742 /* empty */ { $$= NULL; }
7402 54712 | '(' NUM ')' { $$= $2.str; }
7403 ;
7404
7405 func_datetime_precision:
7406 94756 /* empty */ { $$= 0; }
7407 85269 | '(' ')' { $$= 0; }
7408 | '(' NUM ')'
7409 {
7410 int error;
7411
1/2
✓ Branch 0 taken 17538 times.
✗ Branch 1 not taken.
17538 $$= (ulong) my_strtoll10($2.str, NULL, &error);
7412 }
7413 ;
7414
7415 field_options:
7416 480694 /* empty */ { $$ = 0; }
7417 | field_opt_list
7418 ;
7419
7420 field_opt_list:
7421 field_opt_list field_option
7422 {
7423 1165 $$ = $1 | $2;
7424 }
7425 | field_option
7426 ;
7427
7428 field_option:
7429 2331 SIGNED_SYM { $$ = 0; } // TODO: remove undocumented ignored syntax
7430 1982768 | UNSIGNED_SYM { $$ = UNSIGNED_FLAG; }
7431 | ZEROFILL_SYM {
7432 2266 $$ = ZEROFILL_FLAG;
7433
2/4
✓ Branch 0 taken 2266 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2266 times.
✗ Branch 3 not taken.
2266 push_warning(YYTHD, Sql_condition::SL_WARNING,
7434 ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,
7435 ER_THD(YYTHD, ER_WARN_DEPRECATED_ZEROFILL));
7436 }
7437 ;
7438
7439 field_length:
7440 56 '(' LONG_NUM ')' { $$= $2.str; }
7441 | '(' ULONGLONG_NUM ')' { $$= $2.str; }
7442 10 | '(' DECIMAL_NUM ')' { $$= $2.str; }
7443 1444308 | '(' NUM ')' { $$= $2.str; };
7444
7445 opt_field_length:
7446 2613253 /* empty */ { $$= NULL; /* use default length */ }
7447 | field_length
7448 ;
7449
7450 opt_precision:
7451 /* empty */
7452 {
7453 4172 $$.length= NULL;
7454 4172 $$.dec = NULL;
7455 }
7456 | precision
7457 ;
7458
7459 opt_column_attribute_list:
7460 1745206 /* empty */ { $$= NULL; }
7461 | column_attribute_list
7462 ;
7463
7464 column_attribute_list:
7465 column_attribute_list column_attribute
7466 {
7467 1082965 $$= $1;
7468
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1082965 times.
1082965 if ($2 == nullptr)
7469 MYSQL_YYABORT; // OOM
7470
7471
3/4
✓ Branch 0 taken 1082965 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 1082948 times.
1082965 if ($2->has_constraint_enforcement()) {
7472 // $2 is `[NOT] ENFORCED`
7473
3/4
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 16 times.
34 if ($1->back()->set_constraint_enforcement(
7474
2/4
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
✗ Branch 3 not taken.
17 $2->is_constraint_enforced())) {
7475 // $1 is not `CHECK(...)`
7476
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 YYTHD->syntax_error_at(@2);
7477 1 MYSQL_YYABORT;
7478 }
7479 } else {
7480
2/4
✓ Branch 0 taken 1082948 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1082948 times.
1082948 if ($$->push_back($2))
7481 MYSQL_YYABORT; // OOM
7482 }
7483 }
7484 | column_attribute
7485 {
7486
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3756912 times.
3756912 if ($1 == nullptr)
7487 MYSQL_YYABORT; // OOM
7488
7489
3/4
✓ Branch 0 taken 3756912 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 3756910 times.
3756912 if ($1->has_constraint_enforcement()) {
7490 // [NOT] ENFORCED doesn't follow the CHECK clause
7491
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 YYTHD->syntax_error_at(@1);
7492 2 MYSQL_YYABORT;
7493 }
7494
7495 3756910 $$=
7496
2/4
✓ Branch 0 taken 3756910 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3756910 times.
✗ Branch 3 not taken.
3756910 NEW_PTN Mem_root_array<PT_column_attr_base *>(YYMEM_ROOT);
7497
4/8
✓ Branch 0 taken 3756910 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3756910 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3756910 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 3756910 times.
3756910 if ($$ == NULL || $$->push_back($1))
7498 MYSQL_YYABORT; // OOM
7499 }
7500 ;
7501
7502 column_attribute:
7503 NULL_SYM
7504 {
7505
2/4
✓ Branch 0 taken 71975 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 71975 times.
✗ Branch 3 not taken.
71975 $$= NEW_PTN PT_null_column_attr;
7506 }
7507 | not NULL_SYM
7508 {
7509
2/4
✓ Branch 0 taken 3401948 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3401948 times.
✗ Branch 3 not taken.
3401948 $$= NEW_PTN PT_not_null_column_attr;
7510 }
7511 | not SECONDARY_SYM
7512 {
7513
2/4
✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 34 times.
✗ Branch 3 not taken.
34 $$= NEW_PTN PT_secondary_column_attr;
7514 }
7515 | DEFAULT_SYM now_or_signed_literal
7516 {
7517
2/4
✓ Branch 0 taken 346144 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 346144 times.
✗ Branch 3 not taken.
346144 $$= NEW_PTN PT_default_column_attr($2);
7518 }
7519 | DEFAULT_SYM '(' expr ')'
7520 {
7521
2/4
✓ Branch 0 taken 758 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 758 times.
✗ Branch 3 not taken.
758 $$= NEW_PTN PT_generated_default_val_column_attr($3);
7522 }
7523 | ON_SYM UPDATE_SYM now
7524 {
7525
2/4
✓ Branch 0 taken 41168 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 41168 times.
✗ Branch 3 not taken.
41168 $$= NEW_PTN PT_on_update_column_attr(static_cast<uint8>($3));
7526 }
7527 | AUTO_INC
7528 {
7529
2/4
✓ Branch 0 taken 238836 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 238836 times.
✗ Branch 3 not taken.
238836 $$= NEW_PTN PT_auto_increment_column_attr;
7530 }
7531 | SERIAL_SYM DEFAULT_SYM VALUE_SYM
7532 {
7533 $$= NEW_PTN PT_serial_default_value_column_attr;
7534 }
7535 | opt_primary KEY_SYM
7536 {
7537
2/4
✓ Branch 0 taken 39481 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 39481 times.
✗ Branch 3 not taken.
39481 $$= NEW_PTN PT_primary_key_column_attr;
7538 }
7539 | UNIQUE_SYM
7540 {
7541
1/2
✓ Branch 0 taken 392 times.
✗ Branch 1 not taken.
392 $$= NEW_PTN PT_unique_combo_clustering_key_column_attr(KEYTYPE_UNIQUE);
7542 }
7543 | UNIQUE_SYM KEY_SYM
7544 {
7545
1/2
✓ Branch 0 taken 2189 times.
✗ Branch 1 not taken.
2189 $$= NEW_PTN PT_unique_combo_clustering_key_column_attr(KEYTYPE_UNIQUE);
7546 }
7547 | CLUSTERING_SYM
7548 {
7549
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 $$= NEW_PTN PT_unique_combo_clustering_key_column_attr(KEYTYPE_CLUSTERING);
7550 }
7551 | CLUSTERING_SYM KEY_SYM
7552 {
7553
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $$= NEW_PTN PT_unique_combo_clustering_key_column_attr(KEYTYPE_CLUSTERING);
7554 }
7555 | COMMENT_SYM TEXT_STRING_sys
7556 {
7557
2/4
✓ Branch 0 taken 138996 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 138996 times.
✗ Branch 3 not taken.
138996 $$= NEW_PTN PT_comment_column_attr(to_lex_cstring($2));
7558 }
7559 | COLLATE_SYM collation_name
7560 {
7561
2/4
✓ Branch 0 taken 555446 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 555446 times.
✗ Branch 3 not taken.
555446 $$= NEW_PTN PT_collate_column_attr(@2, $2);
7562 }
7563 | COLUMN_FORMAT_SYM column_format
7564 {
7565
1/2
✓ Branch 0 taken 45 times.
✗ Branch 1 not taken.
45 $$= NEW_PTN PT_column_format_column_attr($2, null_lex_cstr);
7566 }
7567 | COLUMN_FORMAT_SYM COMPRESSED_SYM opt_with_compression_dictionary
7568 {
7569
1/2
✓ Branch 0 taken 399 times.
✗ Branch 1 not taken.
399 $$= NEW_PTN PT_column_format_column_attr(COLUMN_FORMAT_TYPE_COMPRESSED, $3);
7570 }
7571 | STORAGE_SYM storage_media
7572 {
7573
2/4
✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 44 times.
✗ Branch 3 not taken.
44 $$= NEW_PTN PT_storage_media_column_attr($2);
7574 }
7575 | SRID_SYM real_ulonglong_num
7576 {
7577
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1479 times.
1480 if ($2 > std::numeric_limits<gis::srid_t>::max())
7578 {
7579
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_DATA_OUT_OF_RANGE, MYF(0), "SRID", "SRID");
7580 1 MYSQL_YYABORT;
7581 }
7582
2/4
✓ Branch 0 taken 1479 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1479 times.
✗ Branch 3 not taken.
1479 $$= NEW_PTN PT_srid_column_attr(static_cast<gis::srid_t>($2));
7583 }
7584 | opt_constraint_name check_constraint
7585 /* See the next branch for [NOT] ENFORCED. */
7586 {
7587
2/4
✓ Branch 0 taken 217 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 217 times.
✗ Branch 3 not taken.
217 $$= NEW_PTN PT_check_constraint_column_attr($1, $2);
7588 }
7589 | constraint_enforcement
7590 /*
7591 This branch is needed to workaround the need of a lookahead of 2 for
7592 the grammar:
7593
7594 { [NOT] NULL | CHECK(...) [NOT] ENFORCED } ...
7595
7596 Note: the column_attribute_list rule rejects all unexpected
7597 [NOT] ENFORCED sequences.
7598 */
7599 {
7600
2/4
✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 19 times.
✗ Branch 3 not taken.
19 $$ = NEW_PTN PT_constraint_enforcement_attr($1);
7601 }
7602 | ENGINE_ATTRIBUTE_SYM opt_equal json_attribute
7603 {
7604
1/2
✓ Branch 0 taken 49 times.
✗ Branch 1 not taken.
49 $$ = make_column_engine_attribute(YYMEM_ROOT, $3);
7605 }
7606 | SECONDARY_ENGINE_ATTRIBUTE_SYM opt_equal json_attribute
7607 {
7608
1/2
✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
58 $$ = make_column_secondary_engine_attribute(YYMEM_ROOT, $3);
7609 }
7610 | visibility
7611 {
7612
2/4
✓ Branch 0 taken 194 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 194 times.
✗ Branch 3 not taken.
194 $$ = NEW_PTN PT_column_visibility_attr($1);
7613 }
7614 ;
7615
7616 opt_with_compression_dictionary:
7617 73 /* empty */ { $$= null_lex_cstr; }
7618 | WITH COMPRESSION_DICTIONARY_SYM ident
7619 {
7620 326 $$= to_lex_cstring($3);
7621 }
7622 ;
7623
7624 column_format:
7625 14 DEFAULT_SYM { $$= COLUMN_FORMAT_TYPE_DEFAULT; }
7626 15 | FIXED_SYM { $$= COLUMN_FORMAT_TYPE_FIXED; }
7627 16 | DYNAMIC_SYM { $$= COLUMN_FORMAT_TYPE_DYNAMIC; }
7628 ;
7629
7630 storage_media:
7631 5 DEFAULT_SYM { $$= HA_SM_DEFAULT; }
7632 19 | DISK_SYM { $$= HA_SM_DISK; }
7633 20 | MEMORY_SYM { $$= HA_SM_MEMORY; }
7634 ;
7635
7636 now:
7637 NOW_SYM func_datetime_precision
7638 {
7639 195888 $$= $2;
7640 };
7641
7642 now_or_signed_literal:
7643 now
7644 {
7645
2/4
✓ Branch 0 taken 53997 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 53997 times.
✗ Branch 3 not taken.
53997 $$= NEW_PTN Item_func_now_local(@$, static_cast<uint8>($1));
7646 }
7647 | signed_literal_or_null
7648 ;
7649
7650 character_set:
7651 CHAR_SYM SET_SYM
7652 | CHARSET
7653 ;
7654
7655 charset_name:
7656 ident_or_text
7657 {
7658
3/4
✓ Branch 0 taken 848036 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 848026 times.
848035 if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))))
7659 {
7660
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
7661 10 MYSQL_YYABORT;
7662 }
7663
1/2
✓ Branch 0 taken 848025 times.
✗ Branch 1 not taken.
848026 YYLIP->warn_on_deprecated_charset($$, $1.str);
7664 }
7665 261 | BINARY_SYM { $$= &my_charset_bin; }
7666 ;
7667
7668 opt_load_data_charset:
7669 56534 /* Empty */ { $$= NULL; }
7670 13379 | character_set charset_name { $$ = $2; }
7671 ;
7672
7673 old_or_new_charset_name:
7674 ident_or_text
7675 {
7676
5/6
✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 25 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 29 times.
35 if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))) &&
7677
3/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
5 !($$=get_old_charset_by_name($1.str)))
7678 {
7679
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
7680 1 MYSQL_YYABORT;
7681 }
7682 }
7683 1 | BINARY_SYM { $$= &my_charset_bin; }
7684 ;
7685
7686 old_or_new_charset_name_or_default:
7687 30 old_or_new_charset_name { $$=$1; }
7688 10 | DEFAULT_SYM { $$=NULL; }
7689 ;
7690
7691 collation_name:
7692 ident_or_text
7693 {
7694
3/4
✓ Branch 0 taken 987282 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
✓ Branch 3 taken 987269 times.
987282 if (!($$= mysqld_collation_get_by_name($1.str)))
7695 13 MYSQL_YYABORT;
7696
1/2
✓ Branch 0 taken 987269 times.
✗ Branch 1 not taken.
987269 YYLIP->warn_on_deprecated_collation($$);
7697 }
7698 5 | BINARY_SYM { $$= &my_charset_bin; }
7699 ;
7700
7701 opt_collate:
7702 394345 /* empty */ { $$ = nullptr; }
7703 1281 | COLLATE_SYM collation_name { $$ = $2; }
7704 ;
7705
7706 opt_default:
7707 /* empty */ {}
7708 | DEFAULT_SYM {}
7709 ;
7710
7711
7712 ascii:
7713 ASCII_SYM {
7714
1/2
✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
82 push_deprecated_warn(YYTHD, "ASCII", "CHARACTER SET charset_name");
7715 82 $$= &my_charset_latin1;
7716 }
7717 | BINARY_SYM ASCII_SYM {
7718
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 warn_about_deprecated_binary(YYTHD);
7719
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 push_deprecated_warn(YYTHD, "ASCII", "CHARACTER SET charset_name");
7720 3 $$= &my_charset_latin1_bin;
7721 }
7722 | ASCII_SYM BINARY_SYM {
7723
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 push_deprecated_warn(YYTHD, "ASCII", "CHARACTER SET charset_name");
7724
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 warn_about_deprecated_binary(YYTHD);
7725 3 $$= &my_charset_latin1_bin;
7726 }
7727 ;
7728
7729 unicode:
7730 UNICODE_SYM
7731 {
7732
1/2
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
37 push_deprecated_warn(YYTHD, "UNICODE", "CHARACTER SET charset_name");
7733
2/4
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 37 times.
37 if (!($$= get_charset_by_csname("ucs2", MY_CS_PRIMARY,MYF(0))))
7734 {
7735 my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), "ucs2");
7736 MYSQL_YYABORT;
7737 }
7738 }
7739 | UNICODE_SYM BINARY_SYM
7740 {
7741
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 push_deprecated_warn(YYTHD, "UNICODE", "CHARACTER SET charset_name");
7742
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 warn_about_deprecated_binary(YYTHD);
7743
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
3 if (!($$= mysqld_collation_get_by_name("ucs2_bin")))
7744 MYSQL_YYABORT;
7745 }
7746 | BINARY_SYM UNICODE_SYM
7747 {
7748
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 warn_about_deprecated_binary(YYTHD);
7749
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 push_deprecated_warn(YYTHD, "UNICODE", "CHARACTER SET charset_name");
7750
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
2 if (!($$= mysqld_collation_get_by_name("ucs2_bin")))
7751 my_error(ER_UNKNOWN_COLLATION, MYF(0), "ucs2_bin");
7752 }
7753 ;
7754
7755 opt_charset_with_opt_binary:
7756 /* empty */
7757 {
7758 2294494 $$.charset= NULL;
7759 2294494 $$.force_binary= false;
7760 }
7761 | ascii
7762 {
7763 88 $$.charset= $1;
7764 88 $$.force_binary= false;
7765 }
7766 | unicode
7767 {
7768 42 $$.charset= $1;
7769 42 $$.force_binary= false;
7770 }
7771 | BYTE_SYM
7772 {
7773 9 $$.charset= &my_charset_bin;
7774 9 $$.force_binary= false;
7775 }
7776 | character_set charset_name opt_bin_mod
7777 {
7778
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 282509 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
282510 $$.charset= $3 ? get_bin_collation($2) : $2;
7779
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 282510 times.
282510 if ($$.charset == NULL)
7780 MYSQL_YYABORT;
7781 282510 $$.force_binary= false;
7782 }
7783 | BINARY_SYM
7784 {
7785
1/2
✓ Branch 0 taken 9754 times.
✗ Branch 1 not taken.
9754 warn_about_deprecated_binary(YYTHD);
7786 9754 $$.charset= NULL;
7787 9754 $$.force_binary= true;
7788 }
7789 | BINARY_SYM character_set charset_name
7790 {
7791
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 warn_about_deprecated_binary(YYTHD);
7792
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 $$.charset= get_bin_collation($3);
7793
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if ($$.charset == NULL)
7794 MYSQL_YYABORT;
7795 5 $$.force_binary= false;
7796 }
7797 ;
7798
7799 opt_bin_mod:
7800 282581 /* empty */ { $$= false; }
7801 | BINARY_SYM {
7802
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 warn_about_deprecated_binary(YYTHD);
7803 1 $$= true;
7804 }
7805 ;
7806
7807 ws_num_codepoints:
7808 '(' real_ulong_num
7809 {
7810
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 576 times.
577 if ($2 == 0)
7811 {
7812
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 YYTHD->syntax_error();
7813 1 MYSQL_YYABORT;
7814 }
7815 }
7816 ')'
7817 576 { $$= $2; }
7818 ;
7819
7820 opt_primary:
7821 /* empty */
7822 | PRIMARY_SYM
7823 ;
7824
7825 references:
7826 REFERENCES
7827 table_ident
7828 opt_ref_list
7829 opt_match_clause
7830 opt_on_update_delete
7831 {
7832 612918 $$.table_name= $2;
7833 612918 $$.reference_list= $3;
7834 612918 $$.fk_match_option= $4;
7835 612918 $$.fk_update_opt= $5.fk_update_opt;
7836 612918 $$.fk_delete_opt= $5.fk_delete_opt;
7837 }
7838 ;
7839
7840 opt_ref_list:
7841 6 /* empty */ { $$= NULL; }
7842 612916 | '(' reference_list ')' { $$= $2; }
7843 ;
7844
7845 reference_list:
7846 reference_list ',' ident
7847 {
7848 470 $$= $1;
7849
1/2
✓ Branch 0 taken 470 times.
✗ Branch 1 not taken.
470 auto key= NEW_PTN Key_part_spec(to_lex_cstring($3), 0, ORDER_ASC);
7850
4/8
✓ Branch 0 taken 470 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 470 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 470 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 470 times.
470 if (key == NULL || $$->push_back(key))
7851 MYSQL_YYABORT;
7852 }
7853 | ident
7854 {
7855
1/2
✓ Branch 0 taken 612916 times.
✗ Branch 1 not taken.
612916 $$= NEW_PTN List<Key_part_spec>;
7856
1/2
✓ Branch 0 taken 612916 times.
✗ Branch 1 not taken.
612916 auto key= NEW_PTN Key_part_spec(to_lex_cstring($1), 0, ORDER_ASC);
7857
5/10
✓ Branch 0 taken 612916 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 612916 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 612916 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 612916 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 612916 times.
612916 if ($$ == NULL || key == NULL || $$->push_back(key))
7858 MYSQL_YYABORT;
7859 }
7860 ;
7861
7862 opt_match_clause:
7863 612918 /* empty */ { $$= FK_MATCH_UNDEF; }
7864 3 | MATCH FULL { $$= FK_MATCH_FULL; }
7865 1 | MATCH PARTIAL { $$= FK_MATCH_PARTIAL; }
7866 | MATCH SIMPLE_SYM { $$= FK_MATCH_SIMPLE; }
7867 ;
7868
7869 opt_on_update_delete:
7870 /* empty */
7871 {
7872 612103 $$.fk_update_opt= FK_OPTION_UNDEF;
7873 612103 $$.fk_delete_opt= FK_OPTION_UNDEF;
7874 }
7875 | ON_SYM UPDATE_SYM delete_option
7876 {
7877 157 $$.fk_update_opt= $3;
7878 157 $$.fk_delete_opt= FK_OPTION_UNDEF;
7879 }
7880 | ON_SYM DELETE_SYM delete_option
7881 {
7882 128 $$.fk_update_opt= FK_OPTION_UNDEF;
7883 128 $$.fk_delete_opt= $3;
7884 }
7885 | ON_SYM UPDATE_SYM delete_option
7886 ON_SYM DELETE_SYM delete_option
7887 {
7888 25 $$.fk_update_opt= $3;
7889 25 $$.fk_delete_opt= $6;
7890 }
7891 | ON_SYM DELETE_SYM delete_option
7892 ON_SYM UPDATE_SYM delete_option
7893 {
7894 505 $$.fk_update_opt= $6;
7895 505 $$.fk_delete_opt= $3;
7896 }
7897 ;
7898
7899 delete_option:
7900 918 RESTRICT { $$= FK_OPTION_RESTRICT; }
7901 300 | CASCADE { $$= FK_OPTION_CASCADE; }
7902 79 | SET_SYM NULL_SYM { $$= FK_OPTION_SET_NULL; }
7903 42 | NO_SYM ACTION { $$= FK_OPTION_NO_ACTION; }
7904 10 | SET_SYM DEFAULT_SYM { $$= FK_OPTION_DEFAULT; }
7905 ;
7906
7907 constraint_key_type:
7908 420100 PRIMARY_SYM KEY_SYM { $$= KEYTYPE_PRIMARY; }
7909 431609 | unique_combo_clustering opt_key_or_index { $$= $1; }
7910
7911 ;
7912
7913 key_or_index:
7914 KEY_SYM {}
7915 | INDEX_SYM {}
7916 ;
7917
7918 opt_key_or_index:
7919 /* empty */ {}
7920 | key_or_index
7921 ;
7922
7923 keys_or_index:
7924 KEYS {}
7925 | INDEX_SYM {}
7926 | INDEXES {}
7927 ;
7928
7929 opt_unique_combo_clustering:
7930 2909 /* empty */ { $$= KEYTYPE_MULTIPLE; }
7931 | unique_combo_clustering
7932 ;
7933
7934 unique_combo_clustering:
7935 UNIQUE_SYM
7936 {
7937 6328 $$= KEYTYPE_UNIQUE;
7938 }
7939 | UNIQUE_SYM KEY_SYM
7940 {
7941 426781 $$= KEYTYPE_UNIQUE;
7942 }
7943 | CLUSTERING_SYM
7944 {
7945 6 $$= static_cast<keytype>(KEYTYPE_MULTIPLE | KEYTYPE_CLUSTERING);
7946 }
7947 | CLUSTERING_SYM KEY_SYM
7948 {
7949 3 $$= static_cast<keytype>(KEYTYPE_MULTIPLE | KEYTYPE_CLUSTERING);
7950 }
7951 | UNIQUE_SYM CLUSTERING_SYM
7952 {
7953 2 $$= static_cast<keytype>(KEYTYPE_UNIQUE | KEYTYPE_CLUSTERING);
7954 }
7955 | UNIQUE_SYM CLUSTERING_SYM KEY_SYM
7956 {
7957 2 $$= static_cast<keytype>(KEYTYPE_UNIQUE | KEYTYPE_CLUSTERING);
7958 }
7959 | CLUSTERING_SYM UNIQUE_SYM
7960 {
7961 2 $$= static_cast<keytype>(KEYTYPE_UNIQUE | KEYTYPE_CLUSTERING);
7962 }
7963 | CLUSTERING_SYM UNIQUE_SYM KEY_SYM
7964 {
7965 2 $$= static_cast<keytype>(KEYTYPE_UNIQUE | KEYTYPE_CLUSTERING);
7966 }
7967
7968 opt_fulltext_index_options:
7969 991 /* Empty. */ { $$.init(YYMEM_ROOT); }
7970 | fulltext_index_options
7971 ;
7972
7973 fulltext_index_options:
7974 fulltext_index_option
7975 {
7976 296 $$.init(YYMEM_ROOT);
7977
2/4
✓ Branch 0 taken 296 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 296 times.
296 if ($$.push_back($1))
7978 MYSQL_YYABORT; // OOM
7979 }
7980 | fulltext_index_options fulltext_index_option
7981 {
7982 if ($1.push_back($2))
7983 MYSQL_YYABORT; // OOM
7984 $$= $1;
7985 }
7986 ;
7987
7988 fulltext_index_option:
7989 common_index_option
7990 | WITH PARSER_SYM IDENT_sys
7991 {
7992 300 LEX_CSTRING plugin_name= {$3.str, $3.length};
7993
3/4
✓ Branch 0 taken 300 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 296 times.
300 if (!plugin_is_ready(plugin_name, MYSQL_FTPARSER_PLUGIN))
7994 {
7995
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 my_error(ER_FUNCTION_NOT_DEFINED, MYF(0), $3.str);
7996 4 MYSQL_YYABORT;
7997 }
7998 else
7999
1/2
✓ Branch 0 taken 296 times.
✗ Branch 1 not taken.
296 $$= NEW_PTN PT_fulltext_index_parser_name(to_lex_cstring($3));
8000 }
8001 ;
8002
8003 opt_spatial_index_options:
8004 1389 /* Empty. */ { $$.init(YYMEM_ROOT); }
8005 | spatial_index_options
8006 ;
8007
8008 spatial_index_options:
8009 spatial_index_option
8010 {
8011 11 $$.init(YYMEM_ROOT);
8012
2/4
✓ Branch 0 taken 11 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 11 times.
11 if ($$.push_back($1))
8013 MYSQL_YYABORT; // OOM
8014 }
8015 | spatial_index_options spatial_index_option
8016 {
8017
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
3 if ($1.push_back($2))
8018 MYSQL_YYABORT; // OOM
8019 3 $$= $1;
8020 }
8021 ;
8022
8023 spatial_index_option:
8024 common_index_option
8025 ;
8026
8027 opt_index_options:
8028 1279442 /* Empty. */ { $$.init(YYMEM_ROOT); }
8029 | index_options
8030 ;
8031
8032 index_options:
8033 index_option
8034 {
8035 61367 $$.init(YYMEM_ROOT);
8036
2/4
✓ Branch 0 taken 61367 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 61367 times.
61367 if ($$.push_back($1))
8037 MYSQL_YYABORT; // OOM
8038 }
8039 | index_options index_option
8040 {
8041
2/4
✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 40 times.
40 if ($1.push_back($2))
8042 MYSQL_YYABORT; // OOM
8043 40 $$= $1;
8044 }
8045 ;
8046
8047 index_option:
8048 1480 common_index_option { $$= $1; }
8049 59927 | index_type_clause { $$= $1; }
8050 ;
8051
8052 // These options are common for all index types.
8053 common_index_option:
8054
1/2
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
28 KEY_BLOCK_SIZE opt_equal ulong_num { $$= NEW_PTN PT_block_size($3); }
8055 | COMMENT_SYM TEXT_STRING_sys
8056 {
8057
1/2
✓ Branch 0 taken 1373 times.
✗ Branch 1 not taken.
1373 $$= NEW_PTN PT_index_comment(to_lex_cstring($2));
8058 }
8059 | visibility
8060 {
8061
1/2
✓ Branch 0 taken 47 times.
✗ Branch 1 not taken.
47 $$= NEW_PTN PT_index_visibility($1);
8062 }
8063 | ENGINE_ATTRIBUTE_SYM opt_equal json_attribute
8064 {
8065
1/2
✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
23 $$ = make_index_engine_attribute(YYMEM_ROOT, $3);
8066 }
8067 | SECONDARY_ENGINE_ATTRIBUTE_SYM opt_equal json_attribute
8068 {
8069
1/2
✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
23 $$ = make_index_secondary_engine_attribute(YYMEM_ROOT, $3);
8070 }
8071 ;
8072
8073 /*
8074 The syntax for defining an index is:
8075
8076 ... INDEX [index_name] [USING|TYPE] <index_type> ...
8077
8078 The problem is that whereas USING is a reserved word, TYPE is not. We can
8079 still handle it if an index name is supplied, i.e.:
8080
8081 ... INDEX type TYPE <index_type> ...
8082
8083 here the index's name is unmbiguously 'type', but for this:
8084
8085 ... INDEX TYPE <index_type> ...
8086
8087 it's impossible to know what this actually mean - is 'type' the name or the
8088 type? For this reason we accept the TYPE syntax only if a name is supplied.
8089 */
8090 opt_index_name_and_type:
8091 1336045 opt_ident { $$= {$1, NULL}; }
8092
1/2
✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
356 | opt_ident USING index_type { $$= {$1, NEW_PTN PT_index_type($3)}; }
8093 | ident TYPE_SYM index_type { $$= {$1, NEW_PTN PT_index_type($3)}; }
8094 ;
8095
8096 opt_index_type_clause:
8097 4402 /* empty */ { $$ = nullptr; }
8098 | index_type_clause
8099 ;
8100
8101 index_type_clause:
8102
1/2
✓ Branch 0 taken 59947 times.
✗ Branch 1 not taken.
59947 USING index_type { $$= NEW_PTN PT_index_type($2); }
8103
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 | TYPE_SYM index_type { $$= NEW_PTN PT_index_type($2); }
8104 ;
8105
8106 visibility:
8107 83 VISIBLE_SYM { $$= true; }
8108 295 | INVISIBLE_SYM { $$= false; }
8109 ;
8110
8111 index_type:
8112 257 BTREE_SYM { $$= HA_KEY_ALG_BTREE; }
8113 11 | RTREE_SYM { $$= HA_KEY_ALG_RTREE; }
8114 60039 | HASH_SYM { $$= HA_KEY_ALG_HASH; }
8115 ;
8116
8117 key_list:
8118 key_list ',' key_part
8119 {
8120
2/4
✓ Branch 0 taken 468 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 468 times.
468 if ($1->push_back($3))
8121 MYSQL_YYABORT; // OOM
8122 468 $$= $1;
8123 }
8124 | key_part
8125 {
8126 // The order is ignored.
8127
1/2
✓ Branch 0 taken 612913 times.
✗ Branch 1 not taken.
612913 $$= NEW_PTN List<PT_key_part_specification>;
8128
4/8
✓ Branch 0 taken 612913 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 612913 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 612913 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 612913 times.
612913 if ($$ == NULL || $$->push_back($1))
8129 MYSQL_YYABORT; // OOM
8130 }
8131 ;
8132
8133 key_part:
8134 ident opt_ordering_direction
8135 {
8136
2/4
✓ Branch 0 taken 2772541 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2772541 times.
✗ Branch 3 not taken.
2772541 $$= NEW_PTN PT_key_part_specification(to_lex_cstring($1), $2, 0);
8137
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2772541 times.
2772541 if ($$ == NULL)
8138 MYSQL_YYABORT;
8139 }
8140 | ident '(' NUM ')' opt_ordering_direction
8141 {
8142 5877 int key_part_length= atoi($3.str);
8143
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 5876 times.
5877 if (!key_part_length)
8144 {
8145
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_KEY_PART_0, MYF(0), $1.str);
8146 }
8147 5877 $$= NEW_PTN PT_key_part_specification(to_lex_cstring($1), $5,
8148
2/4
✓ Branch 0 taken 5877 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5877 times.
✗ Branch 3 not taken.
5877 key_part_length);
8149
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5877 times.
5877 if ($$ == NULL)
8150 MYSQL_YYABORT; /* purecov: deadcode */
8151 }
8152 ;
8153
8154 key_list_with_expression:
8155 key_list_with_expression ',' key_part_with_expression
8156 {
8157
2/4
✓ Branch 0 taken 822126 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 822126 times.
822126 if ($1->push_back($3))
8158 MYSQL_YYABORT; /* purecov: deadcode */
8159 822126 $$= $1;
8160 }
8161 | key_part_with_expression
8162 {
8163 // The order is ignored.
8164
1/2
✓ Branch 0 taken 1343510 times.
✗ Branch 1 not taken.
1343510 $$= NEW_PTN List<PT_key_part_specification>;
8165
4/8
✓ Branch 0 taken 1343510 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1343510 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1343510 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1343510 times.
1343510 if ($$ == NULL || $$->push_back($1))
8166 MYSQL_YYABORT; /* purecov: deadcode */
8167 }
8168 ;
8169
8170 key_part_with_expression:
8171 key_part
8172 | '(' expr ')' opt_ordering_direction
8173 {
8174
2/4
✓ Branch 0 taken 599 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 599 times.
✗ Branch 3 not taken.
599 $$= NEW_PTN PT_key_part_specification($2, $4);
8175
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 599 times.
599 if ($$ == NULL)
8176 MYSQL_YYABORT;
8177 }
8178 ;
8179
8180 opt_ident:
8181 1903454 /* empty */ { $$= NULL_STR; }
8182 | ident
8183 ;
8184
8185 string_list:
8186 text_string
8187 {
8188
1/2
✓ Branch 0 taken 565672 times.
✗ Branch 1 not taken.
565672 $$= NEW_PTN List<String>;
8189
4/8
✓ Branch 0 taken 565672 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 565672 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 565672 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 565672 times.
565672 if ($$ == NULL || $$->push_back($1))
8190 MYSQL_YYABORT; // OOM
8191 }
8192 | string_list ',' text_string
8193 {
8194
2/4
✓ Branch 0 taken 3708235 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3708235 times.
3708235 if ($$->push_back($3))
8195 MYSQL_YYABORT;
8196 }
8197 ;
8198
8199 /*
8200 ** Alter table
8201 */
8202
8203 alter_table_stmt:
8204 ALTER TABLE_SYM table_ident opt_alter_table_actions
8205 {
8206
1/2
✓ Branch 0 taken 69081 times.
✗ Branch 1 not taken.
138162 $$= NEW_PTN PT_alter_table_stmt(
8207 YYMEM_ROOT,
8208 69081 $1,
8209 69081 $3,
8210 $4.actions,
8211
1/2
✓ Branch 0 taken 69081 times.
✗ Branch 1 not taken.
69081 $4.flags.algo.get_or_default(),
8212
1/2
✓ Branch 0 taken 69081 times.
✗ Branch 1 not taken.
69081 $4.flags.lock.get_or_default(),
8213
2/4
✓ Branch 0 taken 69081 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69081 times.
✗ Branch 3 not taken.
138162 $4.flags.validation.get_or_default());
8214 }
8215 | ALTER TABLE_SYM table_ident standalone_alter_table_action
8216 {
8217
1/2
✓ Branch 0 taken 3487 times.
✗ Branch 1 not taken.
6974 $$= NEW_PTN PT_alter_table_standalone_stmt(
8218 YYMEM_ROOT,
8219 3487 $1,
8220 3487 $3,
8221 $4.action,
8222
1/2
✓ Branch 0 taken 3487 times.
✗ Branch 1 not taken.
3487 $4.flags.algo.get_or_default(),
8223
1/2
✓ Branch 0 taken 3487 times.
✗ Branch 1 not taken.
3487 $4.flags.lock.get_or_default(),
8224
2/4
✓ Branch 0 taken 3487 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3487 times.
✗ Branch 3 not taken.
6974 $4.flags.validation.get_or_default());
8225 }
8226 ;
8227
8228 alter_database_stmt:
8229 ALTER DATABASE ident_or_empty
8230 {
8231
1/2
✓ Branch 0 taken 1137 times.
✗ Branch 1 not taken.
1137 Lex->create_info= YYTHD->alloc_typed<HA_CREATE_INFO>();
8232
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1137 times.
1137 if (Lex->create_info == NULL)
8233 MYSQL_YYABORT; // OOM
8234 1137 Lex->create_info->default_table_charset= NULL;
8235 1137 Lex->create_info->used_fields= 0;
8236 }
8237 alter_database_options
8238 {
8239 1105 LEX *lex=Lex;
8240 1105 lex->sql_command=SQLCOM_ALTER_DB;
8241 1105 lex->name= $3;
8242
4/4
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 1095 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1104 times.
1115 if (lex->name.str == NULL &&
8243
3/4
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 9 times.
10 lex->copy_db_to(&lex->name.str, &lex->name.length))
8244 1 MYSQL_YYABORT;
8245 }
8246 ;
8247
8248 alter_procedure_stmt:
8249 ALTER PROCEDURE_SYM sp_name
8250 {
8251 213 LEX *lex= Lex;
8252
8253
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 212 times.
213 if (lex->sphead)
8254 {
8255
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE");
8256 1 MYSQL_YYABORT;
8257 }
8258 212 memset(&lex->sp_chistics, 0, sizeof(st_sp_chistics));
8259 }
8260 sp_a_chistics
8261 {
8262 212 LEX *lex=Lex;
8263
8264 212 lex->sql_command= SQLCOM_ALTER_PROCEDURE;
8265 212 lex->spname= $3;
8266 }
8267 ;
8268
8269 alter_function_stmt:
8270 ALTER FUNCTION_SYM sp_name
8271 {
8272 176 LEX *lex= Lex;
8273
8274
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 175 times.
176 if (lex->sphead)
8275 {
8276
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
8277 1 MYSQL_YYABORT;
8278 }
8279 175 memset(&lex->sp_chistics, 0, sizeof(st_sp_chistics));
8280 }
8281 sp_a_chistics
8282 {
8283 175 LEX *lex=Lex;
8284
8285 175 lex->sql_command= SQLCOM_ALTER_FUNCTION;
8286 175 lex->spname= $3;
8287 }
8288 ;
8289
8290 alter_view_stmt:
8291 ALTER view_algorithm definer_opt
8292 {
8293 8712 LEX *lex= Lex;
8294
8295
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8712 times.
8712 if (lex->sphead)
8296 {
8297 my_error(ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW");
8298 MYSQL_YYABORT;
8299 }
8300 8712 lex->create_view_mode= enum_view_create_mode::VIEW_ALTER;
8301 }
8302 view_tail
8303 {}
8304 | ALTER definer_opt
8305 /*
8306 We have two separate rules for ALTER VIEW rather that
8307 optional view_algorithm above, to resolve the ambiguity
8308 with the ALTER EVENT below.
8309 */
8310 {
8311 130 LEX *lex= Lex;
8312
8313
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 127 times.
130 if (lex->sphead)
8314 {
8315
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 my_error(ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW");
8316 3 MYSQL_YYABORT;
8317 }
8318 127 lex->create_view_algorithm= VIEW_ALGORITHM_UNDEFINED;
8319 127 lex->create_view_mode= enum_view_create_mode::VIEW_ALTER;
8320 }
8321 view_tail
8322 {}
8323 ;
8324
8325 alter_event_stmt:
8326 ALTER definer_opt EVENT_SYM sp_name
8327 {
8328 /*
8329 It is safe to use Lex->spname because
8330 ALTER EVENT xxx RENATE TO yyy DO ALTER EVENT RENAME TO
8331 is not allowed. Lex->spname is used in the case of RENAME TO
8332 If it had to be supported spname had to be added to
8333 Event_parse_data.
8334 */
8335
8336
2/4
✓ Branch 0 taken 231 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 231 times.
462 if (!(Lex->event_parse_data= new (YYTHD->mem_root) Event_parse_data()))
8337 MYSQL_YYABORT;
8338 231 Lex->event_parse_data->identifier= $4;
8339
8340 231 Lex->sql_command= SQLCOM_ALTER_EVENT;
8341 }
8342 ev_alter_on_schedule_completion
8343 opt_ev_rename_to
8344 opt_ev_status
8345 opt_ev_comment
8346 opt_ev_sql_stmt
8347 {
8348
10/10
✓ Branch 0 taken 146 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 114 times.
✓ Branch 3 taken 32 times.
✓ Branch 4 taken 33 times.
✓ Branch 5 taken 81 times.
✓ Branch 6 taken 5 times.
✓ Branch 7 taken 28 times.
✓ Branch 8 taken 1 times.
✓ Branch 9 taken 4 times.
228 if (!($6 || $7 || $8 || $9 || $10))
8349 {
8350
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 YYTHD->syntax_error();
8351 1 MYSQL_YYABORT;
8352 }
8353 /*
8354 sql_command is set here because some rules in ev_sql_stmt
8355 can overwrite it
8356 */
8357 227 Lex->sql_command= SQLCOM_ALTER_EVENT;
8358 }
8359 ;
8360
8361 alter_logfile_stmt:
8362 ALTER LOGFILE_SYM GROUP_SYM ident ADD lg_undofile
8363 opt_alter_logfile_group_options
8364 {
8365
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
8366
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 if (pc == NULL)
8367 MYSQL_YYABORT; /* purecov: inspected */ // OOM
8368
8369
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 if ($7 != NULL)
8370 {
8371
5/10
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 4 times.
4 if (YYTHD->is_error() || contextualize_array(pc, $7))
8372 MYSQL_YYABORT; /* purecov: inspected */
8373 }
8374
8375
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
8 Lex->m_sql_cmd= NEW_PTN Sql_cmd_logfile_group{ALTER_LOGFILE_GROUP,
8376
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
8 $4, pc, $6};
8377
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 if (!Lex->m_sql_cmd)
8378 MYSQL_YYABORT; /* purecov: inspected */ //OOM
8379
8380 4 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
8381 }
8382
8383 alter_tablespace_stmt:
8384 ALTER TABLESPACE_SYM ident ADD ts_datafile
8385 opt_alter_tablespace_options
8386 {
8387
2/4
✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 27 times.
✗ Branch 3 not taken.
27 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
8388
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 27 times.
27 if (pc == NULL)
8389 MYSQL_YYABORT; /* purecov: inspected */ // OOM
8390
8391
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 18 times.
27 if ($6 != NULL)
8392 {
8393
5/10
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 9 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 9 times.
9 if (YYTHD->is_error() || contextualize_array(pc, $6))
8394 MYSQL_YYABORT; /* purecov: inspected */
8395 }
8396
8397
2/4
✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 27 times.
✗ Branch 3 not taken.
27 Lex->m_sql_cmd= NEW_PTN Sql_cmd_alter_tablespace_add_datafile{$3, $5, pc};
8398
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 27 times.
27 if (!Lex->m_sql_cmd)
8399 MYSQL_YYABORT; /* purecov: inspected */ // OOM
8400
8401 27 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
8402 }
8403 | ALTER TABLESPACE_SYM ident DROP ts_datafile
8404 opt_alter_tablespace_options
8405 {
8406
2/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
5 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
8407
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if (pc == NULL)
8408 MYSQL_YYABORT; /* purecov: inspected */ // OOM
8409
8410
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 3 times.
5 if ($6 != NULL)
8411 {
8412
5/10
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
2 if (YYTHD->is_error() || contextualize_array(pc, $6))
8413 MYSQL_YYABORT; /* purecov: inspected */
8414 }
8415
8416 5 Lex->m_sql_cmd=
8417
2/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
5 NEW_PTN Sql_cmd_alter_tablespace_drop_datafile{$3, $5, pc};
8418
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if (!Lex->m_sql_cmd)
8419 MYSQL_YYABORT; /* purecov: inspected */ // OOM
8420
8421 5 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
8422 }
8423 | ALTER TABLESPACE_SYM ident RENAME TO_SYM ident
8424 {
8425
2/4
✓ Branch 0 taken 85 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 85 times.
✗ Branch 3 not taken.
85 Lex->m_sql_cmd= NEW_PTN Sql_cmd_alter_tablespace_rename{$3, $6};
8426
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 85 times.
85 if (!Lex->m_sql_cmd)
8427 MYSQL_YYABORT; // OOM
8428
8429 85 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
8430 }
8431 | ALTER TABLESPACE_SYM ident alter_tablespace_option_list
8432 {
8433
2/4
✓ Branch 0 taken 543 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 543 times.
✗ Branch 3 not taken.
543 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
8434
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 543 times.
543 if (pc == NULL)
8435 MYSQL_YYABORT; // OOM
8436
8437
1/2
✓ Branch 0 taken 543 times.
✗ Branch 1 not taken.
543 if ($4 != NULL)
8438 {
8439
5/10
✓ Branch 0 taken 543 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 543 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 543 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 543 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 543 times.
543 if (YYTHD->is_error() || contextualize_array(pc, $4))
8440 MYSQL_YYABORT;
8441 }
8442
8443 543 Lex->m_sql_cmd=
8444
2/4
✓ Branch 0 taken 543 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 543 times.
✗ Branch 3 not taken.
543 NEW_PTN Sql_cmd_alter_tablespace{$3, pc};
8445
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 543 times.
543 if (!Lex->m_sql_cmd)
8446 MYSQL_YYABORT; // OOM
8447
8448 543 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
8449 }
8450 ;
8451
8452 alter_undo_tablespace_stmt:
8453 ALTER UNDO_SYM TABLESPACE_SYM ident SET_SYM undo_tablespace_state
8454 opt_undo_tablespace_options
8455 {
8456
2/4
✓ Branch 0 taken 565 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 565 times.
✗ Branch 3 not taken.
565 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
8457
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 565 times.
565 if (pc == NULL)
8458 MYSQL_YYABORT; // OOM
8459
8460
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 561 times.
565 if ($7 != NULL)
8461 {
8462
5/10
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 4 times.
4 if (YYTHD->is_error() || contextualize_array(pc, $7))
8463 MYSQL_YYABORT;
8464 }
8465
8466 auto cmd= NEW_PTN Sql_cmd_alter_undo_tablespace{
8467 565 ALTER_UNDO_TABLESPACE, $4,
8468
2/4
✓ Branch 0 taken 565 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 565 times.
✗ Branch 3 not taken.
565 {nullptr, 0}, pc, $6};
8469
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 565 times.
565 if (!cmd)
8470 MYSQL_YYABORT; //OOM
8471 565 Lex->m_sql_cmd= cmd;
8472 565 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
8473 }
8474 ;
8475
8476 alter_server_stmt:
8477 ALTER SERVER_SYM ident_or_text OPTIONS_SYM '(' server_options_list ')'
8478 {
8479 15 LEX *lex= Lex;
8480 15 lex->sql_command= SQLCOM_ALTER_SERVER;
8481 15 lex->server_options.m_server_name= $3;
8482 15 lex->m_sql_cmd=
8483
1/2
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
15 NEW_PTN Sql_cmd_alter_server(&Lex->server_options);
8484 }
8485 ;
8486
8487 alter_user_stmt:
8488 alter_user_command alter_user_list require_clause
8489 connect_options opt_account_lock_password_expire_options
8490 opt_user_attribute
8491 | alter_user_command user_func identified_by_random_password
8492 opt_replace_password opt_retain_current_password
8493 {
8494 $2->first_factor_auth_info = *$3;
8495
8496 if ($4.str != nullptr) {
8497 $2->current_auth = $4;
8498 $2->uses_replace_clause = true;
8499 }
8500 $2->discard_old_password = false;
8501 $2->retain_current_password = $5;
8502 }
8503 | alter_user_command user_func identified_by_password
8504 opt_replace_password opt_retain_current_password
8505 {
8506 166 $2->first_factor_auth_info = *$3;
8507
8508
2/2
✓ Branch 0 taken 83 times.
✓ Branch 1 taken 83 times.
166 if ($4.str != nullptr) {
8509 83 $2->current_auth = $4;
8510 83 $2->uses_replace_clause = true;
8511 }
8512 166 $2->discard_old_password = false;
8513 166 $2->retain_current_password = $5;
8514 }
8515 | alter_user_command user_func DISCARD_SYM OLD_SYM PASSWORD
8516 {
8517 4 $2->discard_old_password = true;
8518 4 $2->retain_current_password = false;
8519 }
8520 | alter_user_command user DEFAULT_SYM ROLE_SYM ALL
8521 {
8522
1/2
✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
53 List<LEX_USER> *users= new (YYMEM_ROOT) List<LEX_USER>;
8523
4/8
✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 53 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 53 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 53 times.
53 if (users == NULL || users->push_back($2))
8524 MYSQL_YYABORT;
8525
1/2
✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
53 List<LEX_USER> *role_list= new (YYMEM_ROOT) List<LEX_USER>;
8526 auto *tmp=
8527 53 NEW_PTN PT_alter_user_default_role(Lex->drop_if_exists,
8528 users, role_list,
8529
1/2
✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
53 role_enum::ROLE_ALL);
8530
5/10
✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 53 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 53 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 53 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 53 times.
53 MAKE_CMD(tmp);
8531 }
8532 | alter_user_command user DEFAULT_SYM ROLE_SYM NONE_SYM
8533 {
8534
1/2
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
15 List<LEX_USER> *users= new (YYMEM_ROOT) List<LEX_USER>;
8535
4/8
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 15 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 15 times.
15 if (users == NULL || users->push_back($2))
8536 MYSQL_YYABORT;
8537
1/2
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
15 List<LEX_USER> *role_list= new (YYMEM_ROOT) List<LEX_USER>;
8538 auto *tmp=
8539 15 NEW_PTN PT_alter_user_default_role(Lex->drop_if_exists,
8540 users, role_list,
8541
1/2
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
15 role_enum::ROLE_NONE);
8542
5/10
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 15 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 15 times.
15 MAKE_CMD(tmp);
8543 }
8544 | alter_user_command user DEFAULT_SYM ROLE_SYM role_list
8545 {
8546
1/2
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
52 List<LEX_USER> *users= new (YYMEM_ROOT) List<LEX_USER>;
8547
4/8
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 52 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 52 times.
52 if (users == NULL || users->push_back($2))
8548 MYSQL_YYABORT;
8549 auto *tmp=
8550 52 NEW_PTN PT_alter_user_default_role(Lex->drop_if_exists,
8551 52 users, $5,
8552
1/2
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
52 role_enum::ROLE_NAME);
8553
5/10
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 52 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 52 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 52 times.
52 MAKE_CMD(tmp);
8554 }
8555 | alter_user_command user opt_user_registration
8556 {
8557 if ($2->mfa_list.push_back($3))
8558 MYSQL_YYABORT; // OOM
8559 LEX *lex=Lex;
8560 lex->users_list.push_front ($2);
8561 }
8562 | alter_user_command user_func opt_user_registration
8563 {
8564 if ($2->mfa_list.push_back($3))
8565 MYSQL_YYABORT; // OOM
8566 }
8567 ;
8568
8569 opt_replace_password:
8570 760 /* empty */ { $$ = LEX_CSTRING{nullptr, 0}; }
8571 297 | REPLACE_SYM TEXT_STRING_password { $$ = to_lex_cstring($2); }
8572 ;
8573
8574 alter_resource_group_stmt:
8575 ALTER RESOURCE_SYM GROUP_SYM ident opt_resource_group_vcpu_list
8576 opt_resource_group_priority opt_resource_group_enable_disable
8577 opt_force
8578 {
8579
1/2
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
54 $$= NEW_PTN PT_alter_resource_group(to_lex_cstring($4),
8580 36 $5, $6, $7, $8);
8581 }
8582 ;
8583
8584 alter_user_command:
8585 ALTER USER if_exists
8586 {
8587 2039 LEX *lex= Lex;
8588 2039 lex->sql_command= SQLCOM_ALTER_USER;
8589 2039 lex->drop_if_exists= $3;
8590 }
8591 ;
8592
8593 opt_user_attribute:
8594 /* empty */
8595 {
8596 7846 LEX *lex= Lex;
8597 7846 lex->alter_user_attribute =
8598 enum_alter_user_attribute::ALTER_USER_COMMENT_NOT_USED;
8599 }
8600 | ATTRIBUTE_SYM TEXT_STRING_literal
8601 {
8602 29 LEX *lex= Lex;
8603 29 lex->alter_user_attribute =
8604 enum_alter_user_attribute::ALTER_USER_ATTRIBUTE;
8605 29 lex->alter_user_comment_text = $2;
8606 }
8607 | COMMENT_SYM TEXT_STRING_literal
8608 {
8609 35 LEX *lex= Lex;
8610 35 lex->alter_user_attribute =
8611 enum_alter_user_attribute::ALTER_USER_COMMENT;
8612 35 lex->alter_user_comment_text = $2;
8613 }
8614 ;
8615 opt_account_lock_password_expire_options:
8616 /* empty */ {}
8617 | opt_account_lock_password_expire_option_list
8618 ;
8619
8620 opt_account_lock_password_expire_option_list:
8621 opt_account_lock_password_expire_option
8622 | opt_account_lock_password_expire_option_list opt_account_lock_password_expire_option
8623 ;
8624
8625 opt_account_lock_password_expire_option:
8626 ACCOUNT_SYM UNLOCK_SYM
8627 {
8628 143 LEX *lex=Lex;
8629 143 lex->alter_password.update_account_locked_column= true;
8630 143 lex->alter_password.account_locked= false;
8631 }
8632 | ACCOUNT_SYM LOCK_SYM
8633 {
8634 777 LEX *lex=Lex;
8635 777 lex->alter_password.update_account_locked_column= true;
8636 777 lex->alter_password.account_locked= true;
8637 }
8638 | PASSWORD EXPIRE_SYM
8639 {
8640 160 LEX *lex= Lex;
8641 160 lex->alter_password.expire_after_days= 0;
8642 160 lex->alter_password.update_password_expired_column= true;
8643 160 lex->alter_password.update_password_expired_fields= true;
8644 160 lex->alter_password.use_default_password_lifetime= true;
8645 }
8646 | PASSWORD EXPIRE_SYM INTERVAL_SYM real_ulong_num DAY_SYM
8647 {
8648 67 LEX *lex= Lex;
8649
4/4
✓ Branch 0 taken 66 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 7 times.
✓ Branch 3 taken 59 times.
67 if ($4 == 0 || $4 > UINT_MAX16)
8650 {
8651 char buf[MAX_BIGINT_WIDTH + 1];
8652 8 snprintf(buf, sizeof(buf), "%lu", $4);
8653
1/2
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
8 my_error(ER_WRONG_VALUE, MYF(0), "DAY", buf);
8654 8 MYSQL_YYABORT;
8655 }
8656 59 lex->alter_password.expire_after_days= $4;
8657 59 lex->alter_password.update_password_expired_column= false;
8658 59 lex->alter_password.update_password_expired_fields= true;
8659 59 lex->alter_password.use_default_password_lifetime= false;
8660 }
8661 | PASSWORD EXPIRE_SYM NEVER_SYM
8662 {
8663 83 LEX *lex= Lex;
8664 83 lex->alter_password.expire_after_days= 0;
8665 83 lex->alter_password.update_password_expired_column= false;
8666 83 lex->alter_password.update_password_expired_fields= true;
8667 83 lex->alter_password.use_default_password_lifetime= false;
8668 }
8669 | PASSWORD EXPIRE_SYM DEFAULT_SYM
8670 {
8671 67 LEX *lex= Lex;
8672 67 lex->alter_password.expire_after_days= 0;
8673 67 lex->alter_password.update_password_expired_column= false;
8674 67 Lex->alter_password.update_password_expired_fields= true;
8675 67 lex->alter_password.use_default_password_lifetime= true;
8676 }
8677 | PASSWORD HISTORY_SYM real_ulong_num
8678 {
8679 21 LEX *lex= Lex;
8680 21 lex->alter_password.password_history_length= $3;
8681 21 lex->alter_password.update_password_history= true;
8682 21 lex->alter_password.use_default_password_history= false;
8683 }
8684 | PASSWORD HISTORY_SYM DEFAULT_SYM
8685 {
8686 22 LEX *lex= Lex;
8687 22 lex->alter_password.password_history_length= 0;
8688 22 lex->alter_password.update_password_history= true;
8689 22 lex->alter_password.use_default_password_history= true;
8690 }
8691 | PASSWORD REUSE_SYM INTERVAL_SYM real_ulong_num DAY_SYM
8692 {
8693 6 LEX *lex= Lex;
8694 6 lex->alter_password.password_reuse_interval= $4;
8695 6 lex->alter_password.update_password_reuse_interval= true;
8696 6 lex->alter_password.use_default_password_reuse_interval= false;
8697 }
8698 | PASSWORD REUSE_SYM INTERVAL_SYM DEFAULT_SYM
8699 {
8700 17 LEX *lex= Lex;
8701 17 lex->alter_password.password_reuse_interval= 0;
8702 17 lex->alter_password.update_password_reuse_interval= true;
8703 17 lex->alter_password.use_default_password_reuse_interval= true;
8704 }
8705 | PASSWORD REQUIRE_SYM CURRENT_SYM
8706 {
8707 25 LEX *lex= Lex;
8708 25 lex->alter_password.update_password_require_current=
8709 Lex_acl_attrib_udyn::YES;
8710 }
8711 | PASSWORD REQUIRE_SYM CURRENT_SYM DEFAULT_SYM
8712 {
8713 31 LEX *lex= Lex;
8714 31 lex->alter_password.update_password_require_current=
8715 Lex_acl_attrib_udyn::DEFAULT;
8716 }
8717 | PASSWORD REQUIRE_SYM CURRENT_SYM OPTIONAL_SYM
8718 {
8719 18 LEX *lex= Lex;
8720 18 lex->alter_password.update_password_require_current=
8721 Lex_acl_attrib_udyn::NO;
8722 }
8723 | FAILED_LOGIN_ATTEMPTS_SYM real_ulong_num
8724 {
8725 54 LEX *lex= Lex;
8726
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 53 times.
54 if ($2 > INT_MAX16) {
8727 char buf[MAX_BIGINT_WIDTH + 1];
8728 1 snprintf(buf, sizeof(buf), "%lu", $2);
8729
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_WRONG_VALUE, MYF(0), "FAILED_LOGIN_ATTEMPTS", buf);
8730 1 MYSQL_YYABORT;
8731 }
8732 53 lex->alter_password.update_failed_login_attempts= true;
8733 53 lex->alter_password.failed_login_attempts= $2;
8734 }
8735 | PASSWORD_LOCK_TIME_SYM real_ulong_num
8736 {
8737 52 LEX *lex= Lex;
8738
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 51 times.
52 if ($2 > INT_MAX16) {
8739 char buf[MAX_BIGINT_WIDTH + 1];
8740 1 snprintf(buf, sizeof(buf), "%lu", $2);
8741
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_WRONG_VALUE, MYF(0), "PASSWORD_LOCK_TIME", buf);
8742 1 MYSQL_YYABORT;
8743 }
8744 51 lex->alter_password.update_password_lock_time= true;
8745 51 lex->alter_password.password_lock_time= $2;
8746 }
8747 | PASSWORD_LOCK_TIME_SYM UNBOUNDED_SYM
8748 {
8749 13 LEX *lex= Lex;
8750 13 lex->alter_password.update_password_lock_time= true;
8751 13 lex->alter_password.password_lock_time= -1;
8752 }
8753 ;
8754
8755 connect_options:
8756 /* empty */ {}
8757 | WITH connect_option_list
8758 ;
8759
8760 connect_option_list:
8761 connect_option_list connect_option {}
8762 | connect_option {}
8763 ;
8764
8765 connect_option:
8766 MAX_QUERIES_PER_HOUR ulong_num
8767 {
8768 184 LEX *lex=Lex;
8769 184 lex->mqh.questions=$2;
8770 184 lex->mqh.specified_limits|= USER_RESOURCES::QUERIES_PER_HOUR;
8771 }
8772 | MAX_UPDATES_PER_HOUR ulong_num
8773 {
8774 17 LEX *lex=Lex;
8775 17 lex->mqh.updates=$2;
8776 17 lex->mqh.specified_limits|= USER_RESOURCES::UPDATES_PER_HOUR;
8777 }
8778 | MAX_CONNECTIONS_PER_HOUR ulong_num
8779 {
8780 52 LEX *lex=Lex;
8781 52 lex->mqh.conn_per_hour= $2;
8782 52 lex->mqh.specified_limits|= USER_RESOURCES::CONNECTIONS_PER_HOUR;
8783 }
8784 | MAX_USER_CONNECTIONS_SYM ulong_num
8785 {
8786 165 LEX *lex=Lex;
8787 165 lex->mqh.user_conn= $2;
8788 165 lex->mqh.specified_limits|= USER_RESOURCES::USER_CONNECTIONS;
8789 }
8790 ;
8791
8792 user_func:
8793 USER '(' ')'
8794 {
8795 /* empty LEX_USER means current_user */
8796 LEX_USER *curr_user;
8797
2/4
✓ Branch 0 taken 178 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 178 times.
178 if (!(curr_user= LEX_USER::alloc(YYTHD)))
8798 MYSQL_YYABORT;
8799
8800
1/2
✓ Branch 0 taken 178 times.
✗ Branch 1 not taken.
178 Lex->users_list.push_back(curr_user);
8801 178 $$= curr_user;
8802 }
8803 ;
8804
8805 ev_alter_on_schedule_completion:
8806 149 /* empty */ { $$= 0;}
8807 71 | ON_SYM SCHEDULE_SYM ev_schedule_time { $$= 1; }
8808 3 | ev_on_completion { $$= 1; }
8809 8 | ON_SYM SCHEDULE_SYM ev_schedule_time ev_on_completion { $$= 1; }
8810 ;
8811
8812 opt_ev_rename_to:
8813 197 /* empty */ { $$= 0;}
8814 | RENAME TO_SYM sp_name
8815 {
8816 /*
8817 Use lex's spname to hold the new name.
8818 The original name is in the Event_parse_data object
8819 */
8820 33 Lex->spname= $3;
8821 33 $$= 1;
8822 }
8823 ;
8824
8825 opt_ev_sql_stmt:
8826 202 /* empty*/ { $$= 0;}
8827 26 | DO_SYM ev_sql_stmt { $$= 1; }
8828 ;
8829
8830 ident_or_empty:
8831 12 /* empty */ { $$.str= 0; $$.length= 0; }
8832 1125 | ident { $$= $1; }
8833 ;
8834
8835 opt_alter_table_actions:
8836 opt_alter_command_list
8837 | opt_alter_command_list alter_table_partition_options
8838 {
8839 784 $$= $1;
8840
2/2
✓ Branch 0 taken 754 times.
✓ Branch 1 taken 30 times.
784 if ($$.actions == NULL)
8841 {
8842
2/4
✓ Branch 0 taken 754 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 754 times.
✗ Branch 3 not taken.
754 $$.actions= NEW_PTN Mem_root_array<PT_ddl_table_option *>(YYMEM_ROOT);
8843
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 754 times.
754 if ($$.actions == NULL)
8844 MYSQL_YYABORT; // OOM
8845 }
8846
2/4
✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 784 times.
784 if ($$.actions->push_back($2))
8847 MYSQL_YYABORT; // OOM
8848 }
8849 ;
8850
8851 standalone_alter_table_action:
8852 standalone_alter_commands
8853 {
8854
1/2
✓ Branch 0 taken 3420 times.
✗ Branch 1 not taken.
3420 $$.flags.init();
8855 3420 $$.action= $1;
8856 }
8857 | alter_commands_modifier_list ',' standalone_alter_commands
8858 {
8859 67 $$.flags= $1;
8860 67 $$.action= $3;
8861 }
8862 ;
8863
8864 alter_table_partition_options:
8865 partition_clause
8866 {
8867
2/4
✓ Branch 0 taken 552 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 552 times.
✗ Branch 3 not taken.
552 $$= NEW_PTN PT_alter_table_partition_by($1);
8868 }
8869 | REMOVE_SYM PARTITIONING_SYM
8870 {
8871
2/4
✓ Branch 0 taken 232 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 232 times.
✗ Branch 3 not taken.
232 $$= NEW_PTN PT_alter_table_remove_partitioning;
8872 }
8873 ;
8874
8875 opt_alter_command_list:
8876 /* empty */
8877 {
8878
1/2
✓ Branch 0 taken 769 times.
✗ Branch 1 not taken.
769 $$.flags.init();
8879 769 $$.actions= NULL;
8880 }
8881 | alter_commands_modifier_list
8882 {
8883 26 $$.flags= $1;
8884 26 $$.actions= NULL;
8885 }
8886 | alter_list
8887 | alter_commands_modifier_list ',' alter_list
8888 {
8889 39 $$.flags= $1;
8890
1/2
✓ Branch 0 taken 39 times.
✗ Branch 1 not taken.
39 $$.flags.merge($3.flags);
8891 39 $$.actions= $3.actions;
8892 }
8893 ;
8894
8895 standalone_alter_commands:
8896 DISCARD_SYM TABLESPACE_SYM
8897 {
8898
2/4
✓ Branch 0 taken 512 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 512 times.
✗ Branch 3 not taken.
512 $$= NEW_PTN PT_alter_table_discard_tablespace;
8899 }
8900 | IMPORT TABLESPACE_SYM
8901 {
8902
2/4
✓ Branch 0 taken 511 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 511 times.
✗ Branch 3 not taken.
511 $$= NEW_PTN PT_alter_table_import_tablespace;
8903 }
8904 /*
8905 This part was added for release 5.1 by Mikael Ronström.
8906 From here we insert a number of commands to manage the partitions of a
8907 partitioned table such as adding partitions, dropping partitions,
8908 reorganising partitions in various manners. In future releases the list
8909 will be longer.
8910 */
8911 | ADD PARTITION_SYM opt_no_write_to_binlog
8912 {
8913
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 $$= NEW_PTN PT_alter_table_add_partition($3);
8914 }
8915 | ADD PARTITION_SYM opt_no_write_to_binlog '(' part_def_list ')'
8916 {
8917
2/4
✓ Branch 0 taken 203 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 203 times.
✗ Branch 3 not taken.
203 $$= NEW_PTN PT_alter_table_add_partition_def_list($3, $5);
8918 }
8919 | ADD PARTITION_SYM opt_no_write_to_binlog PARTITIONS_SYM real_ulong_num
8920 {
8921
2/4
✓ Branch 0 taken 125 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 125 times.
✗ Branch 3 not taken.
125 $$= NEW_PTN PT_alter_table_add_partition_num($3, $5);
8922 }
8923 | DROP PARTITION_SYM ident_string_list
8924 {
8925
2/4
✓ Branch 0 taken 317 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 317 times.
✗ Branch 3 not taken.
317 $$= NEW_PTN PT_alter_table_drop_partition(*$3);
8926 }
8927 | REBUILD_SYM PARTITION_SYM opt_no_write_to_binlog
8928 all_or_alt_part_name_list
8929 {
8930
2/4
✓ Branch 0 taken 117 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 117 times.
✗ Branch 3 not taken.
117 $$= NEW_PTN PT_alter_table_rebuild_partition($3, $4);
8931 }
8932 | OPTIMIZE PARTITION_SYM opt_no_write_to_binlog
8933 all_or_alt_part_name_list
8934 {
8935
2/4
✓ Branch 0 taken 46 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 46 times.
✗ Branch 3 not taken.
46 $$= NEW_PTN PT_alter_table_optimize_partition($3, $4);
8936 }
8937 | ANALYZE_SYM PARTITION_SYM opt_no_write_to_binlog
8938 all_or_alt_part_name_list
8939 {
8940
2/4
✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 50 times.
✗ Branch 3 not taken.
50 $$= NEW_PTN PT_alter_table_analyze_partition($3, $4);
8941 }
8942 | CHECK_SYM PARTITION_SYM all_or_alt_part_name_list opt_mi_check_types
8943 {
8944
1/2
✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
70 $$= NEW_PTN PT_alter_table_check_partition($3,
8945
1/2
✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
70 $4.flags, $4.sql_flags);
8946 }
8947 | REPAIR PARTITION_SYM opt_no_write_to_binlog
8948 all_or_alt_part_name_list
8949 opt_mi_repair_types
8950 {
8951
1/2
✓ Branch 0 taken 45 times.
✗ Branch 1 not taken.
90 $$= NEW_PTN PT_alter_table_repair_partition($3, $4,
8952
1/2
✓ Branch 0 taken 45 times.
✗ Branch 1 not taken.
90 $5.flags, $5.sql_flags);
8953 }
8954 | COALESCE PARTITION_SYM opt_no_write_to_binlog real_ulong_num
8955 {
8956
2/4
✓ Branch 0 taken 164 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 164 times.
✗ Branch 3 not taken.
164 $$= NEW_PTN PT_alter_table_coalesce_partition($3, $4);
8957 }
8958 | TRUNCATE_SYM PARTITION_SYM all_or_alt_part_name_list
8959 {
8960
2/4
✓ Branch 0 taken 431 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 431 times.
✗ Branch 3 not taken.
431 $$= NEW_PTN PT_alter_table_truncate_partition($3);
8961 }
8962 | REORGANIZE_SYM PARTITION_SYM opt_no_write_to_binlog
8963 {
8964
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 $$= NEW_PTN PT_alter_table_reorganize_partition($3);
8965 }
8966 | REORGANIZE_SYM PARTITION_SYM opt_no_write_to_binlog
8967 ident_string_list INTO '(' part_def_list ')'
8968 {
8969
2/4
✓ Branch 0 taken 284 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 284 times.
✗ Branch 3 not taken.
284 $$= NEW_PTN PT_alter_table_reorganize_partition_into($3, *$4, $7);
8970 }
8971 | EXCHANGE_SYM PARTITION_SYM ident
8972 WITH TABLE_SYM table_ident opt_with_validation
8973 {
8974
2/4
✓ Branch 0 taken 322 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 322 times.
✗ Branch 3 not taken.
322 $$= NEW_PTN PT_alter_table_exchange_partition($3, $6, $7);
8975 }
8976 | DISCARD_SYM PARTITION_SYM all_or_alt_part_name_list
8977 TABLESPACE_SYM
8978 {
8979
2/4
✓ Branch 0 taken 106 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 106 times.
✗ Branch 3 not taken.
106 $$= NEW_PTN PT_alter_table_discard_partition_tablespace($3);
8980 }
8981 | IMPORT PARTITION_SYM all_or_alt_part_name_list
8982 TABLESPACE_SYM
8983 {
8984
2/4
✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
77 $$= NEW_PTN PT_alter_table_import_partition_tablespace($3);
8985 }
8986 | SECONDARY_LOAD_SYM
8987 {
8988
2/4
✓ Branch 0 taken 101 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 101 times.
✗ Branch 3 not taken.
101 $$= NEW_PTN PT_alter_table_secondary_load;
8989 }
8990 | SECONDARY_UNLOAD_SYM
8991 {
8992
2/4
✓ Branch 0 taken 39 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
✗ Branch 3 not taken.
39 $$= NEW_PTN PT_alter_table_secondary_unload;
8993 }
8994 ;
8995
8996 opt_with_validation:
8997 250 /* empty */ { $$= Alter_info::ALTER_VALIDATION_DEFAULT; }
8998 | with_validation
8999 ;
9000
9001 with_validation:
9002 WITH VALIDATION_SYM
9003 {
9004 42 $$= Alter_info::ALTER_WITH_VALIDATION;
9005 }
9006 | WITHOUT_SYM VALIDATION_SYM
9007 {
9008 66 $$= Alter_info::ALTER_WITHOUT_VALIDATION;
9009 }
9010 ;
9011
9012 all_or_alt_part_name_list:
9013 44 ALL { $$= NULL; }
9014 | ident_string_list
9015 ;
9016
9017 /*
9018 End of management of partition commands
9019 */
9020
9021 alter_list:
9022 alter_list_item
9023 {
9024
1/2
✓ Branch 0 taken 47524 times.
✗ Branch 1 not taken.
47524 $$.flags.init();
9025
2/4
✓ Branch 0 taken 47524 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 47524 times.
✗ Branch 3 not taken.
47524 $$.actions= NEW_PTN Mem_root_array<PT_ddl_table_option *>(YYMEM_ROOT);
9026
4/8
✓ Branch 0 taken 47524 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 47524 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 47524 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 47524 times.
47524 if ($$.actions == NULL || $$.actions->push_back($1))
9027 MYSQL_YYABORT; // OOM
9028 }
9029 | alter_list ',' alter_list_item
9030 {
9031
2/4
✓ Branch 0 taken 33631 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 33631 times.
33631 if ($$.actions->push_back($3))
9032 MYSQL_YYABORT; // OOM
9033 }
9034 | alter_list ',' alter_commands_modifier
9035 {
9036
1/2
✓ Branch 0 taken 4052 times.
✗ Branch 1 not taken.
4052 $$.flags.merge($3);
9037 }
9038 | create_table_options_space_separated
9039 {
9040
1/2
✓ Branch 0 taken 20764 times.
✗ Branch 1 not taken.
20764 $$.flags.init();
9041 20764 $$.actions= $1;
9042 }
9043 | alter_list ',' create_table_options_space_separated
9044 {
9045
3/4
✓ Branch 0 taken 801 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 820 times.
✓ Branch 3 taken 801 times.
1621 for (auto *option : *$3)
9046 {
9047
2/4
✓ Branch 0 taken 820 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 820 times.
820 if ($1.actions->push_back(option))
9048 MYSQL_YYABORT; // OOM
9049 }
9050 }
9051 ;
9052
9053 alter_commands_modifier_list:
9054 alter_commands_modifier
9055 | alter_commands_modifier_list ',' alter_commands_modifier
9056 {
9057 53 $$= $1;
9058
1/2
✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
53 $$.merge($3);
9059 }
9060 ;
9061
9062 alter_list_item:
9063 ADD opt_column ident field_def opt_references opt_place
9064 {
9065
2/4
✓ Branch 0 taken 30366 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 30366 times.
✗ Branch 3 not taken.
30366 $$= NEW_PTN PT_alter_table_add_column($3, $4, $5, $6);
9066 }
9067 | ADD opt_column '(' table_element_list ')'
9068 {
9069
2/4
✓ Branch 0 taken 832 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 832 times.
✗ Branch 3 not taken.
832 $$= NEW_PTN PT_alter_table_add_columns($4);
9070 }
9071 | ADD table_constraint_def
9072 {
9073
2/4
✓ Branch 0 taken 7661 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7661 times.
✗ Branch 3 not taken.
7661 $$= NEW_PTN PT_alter_table_add_constraint($2);
9074 }
9075 | CHANGE opt_column ident ident field_def opt_place
9076 {
9077
2/4
✓ Branch 0 taken 1339 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1339 times.
✗ Branch 3 not taken.
1339 $$= NEW_PTN PT_alter_table_change_column($3, $4, $5, $6);
9078 }
9079 | MODIFY_SYM opt_column ident field_def opt_place
9080 {
9081
2/4
✓ Branch 0 taken 28999 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28999 times.
✗ Branch 3 not taken.
28999 $$= NEW_PTN PT_alter_table_change_column($3, $4, $5);
9082 }
9083 | DROP opt_column ident opt_restrict
9084 {
9085 // Note: opt_restrict ($4) is ignored!
9086
2/4
✓ Branch 0 taken 3056 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3056 times.
✗ Branch 3 not taken.
3056 $$= NEW_PTN PT_alter_table_drop_column($3.str);
9087 }
9088 | DROP FOREIGN KEY_SYM ident
9089 {
9090
2/4
✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 64 times.
✗ Branch 3 not taken.
64 $$= NEW_PTN PT_alter_table_drop_foreign_key($4.str);
9091 }
9092 | DROP PRIMARY_SYM KEY_SYM
9093 {
9094
2/4
✓ Branch 0 taken 1805 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1805 times.
✗ Branch 3 not taken.
1805 $$= NEW_PTN PT_alter_table_drop_key(primary_key_name);
9095 }
9096 | DROP key_or_index ident
9097 {
9098
2/4
✓ Branch 0 taken 1272 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1272 times.
✗ Branch 3 not taken.
1272 $$= NEW_PTN PT_alter_table_drop_key($3.str);
9099 }
9100 | DROP CHECK_SYM ident
9101 {
9102
2/4
✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 27 times.
✗ Branch 3 not taken.
27 $$= NEW_PTN PT_alter_table_drop_check_constraint($3.str);
9103 }
9104 | DROP CONSTRAINT ident
9105 {
9106
2/4
✓ Branch 0 taken 70 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 70 times.
✗ Branch 3 not taken.
70 $$= NEW_PTN PT_alter_table_drop_constraint($3.str);
9107 }
9108 | DISABLE_SYM KEYS
9109 {
9110
2/4
✓ Branch 0 taken 628 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 628 times.
✗ Branch 3 not taken.
628 $$= NEW_PTN PT_alter_table_enable_keys(false);
9111 }
9112 | ENABLE_SYM KEYS
9113 {
9114
2/4
✓ Branch 0 taken 640 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 640 times.
✗ Branch 3 not taken.
640 $$= NEW_PTN PT_alter_table_enable_keys(true);
9115 }
9116 | ALTER opt_column ident SET_SYM DEFAULT_SYM signed_literal_or_null
9117 {
9118
2/4
✓ Branch 0 taken 96 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 96 times.
✗ Branch 3 not taken.
96 $$= NEW_PTN PT_alter_table_set_default($3.str, $6);
9119 }
9120 | ALTER opt_column ident SET_SYM DEFAULT_SYM '(' expr ')'
9121 {
9122
2/4
✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 54 times.
✗ Branch 3 not taken.
54 $$= NEW_PTN PT_alter_table_set_default($3.str, $7);
9123 }
9124 | ALTER opt_column ident DROP DEFAULT_SYM
9125 {
9126
2/4
✓ Branch 0 taken 86 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 86 times.
✗ Branch 3 not taken.
86 $$= NEW_PTN PT_alter_table_set_default($3.str, NULL);
9127 }
9128
9129 | ALTER opt_column ident SET_SYM visibility
9130 {
9131
2/4
✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
✗ Branch 3 not taken.
31 $$= NEW_PTN PT_alter_table_column_visibility($3.str, $5);
9132 }
9133 | ALTER INDEX_SYM ident visibility
9134 {
9135
2/4
✓ Branch 0 taken 106 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 106 times.
✗ Branch 3 not taken.
106 $$= NEW_PTN PT_alter_table_index_visible($3.str, $4);
9136 }
9137 | ALTER CHECK_SYM ident constraint_enforcement
9138 {
9139
2/4
✓ Branch 0 taken 146 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 146 times.
✗ Branch 3 not taken.
146 $$ = NEW_PTN PT_alter_table_enforce_check_constraint($3.str, $4);
9140 }
9141 | ALTER CONSTRAINT ident constraint_enforcement
9142 {
9143
2/4
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
21 $$ = NEW_PTN PT_alter_table_enforce_constraint($3.str, $4);
9144 }
9145 | RENAME opt_to table_ident
9146 {
9147
2/4
✓ Branch 0 taken 1425 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1425 times.
✗ Branch 3 not taken.
1425 $$= NEW_PTN PT_alter_table_rename($3);
9148 }
9149 | RENAME key_or_index ident TO_SYM ident
9150 {
9151
2/4
✓ Branch 0 taken 220 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 220 times.
✗ Branch 3 not taken.
220 $$= NEW_PTN PT_alter_table_rename_key($3.str, $5.str);
9152 }
9153 | RENAME COLUMN_SYM ident TO_SYM ident
9154 {
9155
2/4
✓ Branch 0 taken 102 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 102 times.
✗ Branch 3 not taken.
102 $$= NEW_PTN PT_alter_table_rename_column($3.str, $5.str);
9156 }
9157 | CONVERT_SYM TO_SYM character_set charset_name opt_collate
9158 {
9159
2/4
✓ Branch 0 taken 1953 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1953 times.
✗ Branch 3 not taken.
1953 $$= NEW_PTN PT_alter_table_convert_to_charset($4, $5);
9160 }
9161 | CONVERT_SYM TO_SYM character_set DEFAULT_SYM opt_collate
9162 {
9163
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
14 $$ = NEW_PTN PT_alter_table_convert_to_charset(
9164 YYTHD->variables.collation_database,
9165
3/4
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
14 $5 ? $5 : YYTHD->variables.collation_database);
9166 }
9167 | FORCE_SYM
9168 {
9169
2/4
✓ Branch 0 taken 87 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 87 times.
✗ Branch 3 not taken.
87 $$= NEW_PTN PT_alter_table_force;
9170 }
9171 | ORDER_SYM BY alter_order_list
9172 {
9173
2/4
✓ Branch 0 taken 62 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 62 times.
✗ Branch 3 not taken.
62 $$= NEW_PTN PT_alter_table_order($3);
9174 }
9175 ;
9176
9177 alter_commands_modifier:
9178 alter_algorithm_option
9179 {
9180
1/2
✓ Branch 0 taken 3896 times.
✗ Branch 1 not taken.
3896 $$.init();
9181 3896 $$.algo.set($1);
9182 }
9183 | alter_lock_option
9184 {
9185
1/2
✓ Branch 0 taken 305 times.
✗ Branch 1 not taken.
305 $$.init();
9186 305 $$.lock.set($1);
9187 }
9188 | with_validation
9189 {
9190
1/2
✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
36 $$.init();
9191 36 $$.validation.set($1);
9192 }
9193 ;
9194
9195 opt_index_lock_and_algorithm:
9196
1/2
✓ Branch 0 taken 7341 times.
✗ Branch 1 not taken.
7341 /* Empty. */ { $$.init(); }
9197 | alter_lock_option
9198 {
9199
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 $$.init();
9200 1 $$.lock.set($1);
9201 }
9202 | alter_algorithm_option
9203 {
9204
1/2
✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
44 $$.init();
9205 44 $$.algo.set($1);
9206 }
9207 | alter_lock_option alter_algorithm_option
9208 {
9209
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $$.init();
9210 2 $$.lock.set($1);
9211 2 $$.algo.set($2);
9212 }
9213 | alter_algorithm_option alter_lock_option
9214 {
9215
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $$.init();
9216 2 $$.algo.set($1);
9217 2 $$.lock.set($2);
9218 }
9219 ;
9220
9221 alter_algorithm_option:
9222 3944 ALGORITHM_SYM opt_equal alter_algorithm_option_value { $$= $3; }
9223 ;
9224
9225 alter_algorithm_option_value:
9226 DEFAULT_SYM
9227 {
9228 29 $$= Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT;
9229 }
9230 | ident
9231 {
9232
3/4
✓ Branch 0 taken 3916 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1266 times.
✓ Branch 3 taken 2650 times.
3916 if (is_identifier($1, "INPLACE"))
9233 1266 $$= Alter_info::ALTER_TABLE_ALGORITHM_INPLACE;
9234
3/4
✓ Branch 0 taken 2650 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1029 times.
✓ Branch 3 taken 1621 times.
2650 else if (is_identifier($1, "INSTANT"))
9235 1029 $$= Alter_info::ALTER_TABLE_ALGORITHM_INSTANT;
9236
3/4
✓ Branch 0 taken 1621 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1620 times.
✓ Branch 3 taken 1 times.
1621 else if (is_identifier($1, "COPY"))
9237 1620 $$= Alter_info::ALTER_TABLE_ALGORITHM_COPY;
9238 else
9239 {
9240
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_UNKNOWN_ALTER_ALGORITHM, MYF(0), $1.str);
9241 1 MYSQL_YYABORT;
9242 }
9243 }
9244 ;
9245
9246 alter_lock_option:
9247 310 LOCK_SYM opt_equal alter_lock_option_value { $$= $3; }
9248 ;
9249
9250 alter_lock_option_value:
9251 DEFAULT_SYM
9252 {
9253 15 $$= Alter_info::ALTER_TABLE_LOCK_DEFAULT;
9254 }
9255 | ident
9256 {
9257
3/4
✓ Branch 0 taken 296 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 210 times.
✓ Branch 3 taken 86 times.
296 if (is_identifier($1, "NONE"))
9258 210 $$= Alter_info::ALTER_TABLE_LOCK_NONE;
9259
3/4
✓ Branch 0 taken 86 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 47 times.
✓ Branch 3 taken 39 times.
86 else if (is_identifier($1, "SHARED"))
9260 47 $$= Alter_info::ALTER_TABLE_LOCK_SHARED;
9261
3/4
✓ Branch 0 taken 39 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
✓ Branch 3 taken 1 times.
39 else if (is_identifier($1, "EXCLUSIVE"))
9262 38 $$= Alter_info::ALTER_TABLE_LOCK_EXCLUSIVE;
9263 else
9264 {
9265
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_UNKNOWN_ALTER_LOCK, MYF(0), $1.str);
9266 1 MYSQL_YYABORT;
9267 }
9268 }
9269 ;
9270
9271 opt_column:
9272 /* empty */
9273 | COLUMN_SYM
9274 ;
9275
9276 opt_ignore:
9277 7135270 /* empty */ { $$= false; }
9278 11024 | IGNORE_SYM { $$= true; }
9279 ;
9280
9281 opt_restrict:
9282 173231 /* empty */ { $$= DROP_DEFAULT; }
9283 14 | RESTRICT { $$= DROP_RESTRICT; }
9284 14 | CASCADE { $$= DROP_CASCADE; }
9285 ;
9286
9287 opt_place:
9288 47144 /* empty */ { $$= NULL; }
9289 11797 | AFTER_SYM ident { $$= $2.str; }
9290 1763 | FIRST_SYM { $$= first_keyword; }
9291 ;
9292
9293 opt_to:
9294 /* empty */ {}
9295 | TO_SYM {}
9296 | EQ {}
9297 | AS {}
9298 ;
9299
9300 group_replication:
9301 group_replication_start opt_group_replication_start_options
9302 | STOP_SYM GROUP_REPLICATION
9303 {
9304 2036 LEX *lex = Lex;
9305 2036 lex->sql_command = SQLCOM_STOP_GROUP_REPLICATION;
9306 }
9307 ;
9308
9309 group_replication_start:
9310 START_SYM GROUP_REPLICATION
9311 {
9312 2216 LEX *lex = Lex;
9313
1/2
✓ Branch 0 taken 2216 times.
✗ Branch 1 not taken.
2216 lex->slave_connection.reset();
9314 2216 lex->sql_command = SQLCOM_START_GROUP_REPLICATION;
9315 }
9316 ;
9317
9318 opt_group_replication_start_options:
9319 /* empty */
9320 | group_replication_start_options
9321 ;
9322
9323 group_replication_start_options:
9324 group_replication_start_option
9325 | group_replication_start_options ',' group_replication_start_option
9326 ;
9327
9328 group_replication_start_option:
9329 group_replication_user
9330 | group_replication_password
9331 | group_replication_plugin_auth
9332 ;
9333
9334 group_replication_user:
9335 USER EQ TEXT_STRING_sys_nonewline
9336 {
9337 32 Lex->slave_connection.user = $3.str;
9338
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 30 times.
32 if ($3.length == 0)
9339 {
9340
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_GROUP_REPLICATION_USER_EMPTY_MSG, MYF(0));
9341 2 MYSQL_YYABORT;
9342 }
9343 }
9344 ;
9345
9346 group_replication_password:
9347 PASSWORD EQ TEXT_STRING_sys_nonewline
9348 {
9349 28 Lex->slave_connection.password = $3.str;
9350 28 Lex->contains_plaintext_password = true;
9351
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 27 times.
28 if ($3.length > 32)
9352 {
9353
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_GROUP_REPLICATION_PASSWORD_LENGTH, MYF(0));
9354 1 MYSQL_YYABORT;
9355 }
9356 }
9357 ;
9358
9359 group_replication_plugin_auth:
9360 DEFAULT_AUTH_SYM EQ TEXT_STRING_sys_nonewline
9361 {
9362 13 Lex->slave_connection.plugin_auth= $3.str;
9363 }
9364 ;
9365
9366 replica:
9367 161544 SLAVE { Lex->set_replication_deprecated_syntax_used(); }
9368 | REPLICA_SYM
9369 ;
9370
9371 stop_replica_stmt:
9372 STOP_SYM replica opt_replica_thread_option_list opt_channel
9373 {
9374 6284 LEX *lex=Lex;
9375 6284 lex->sql_command = SQLCOM_SLAVE_STOP;
9376 6284 lex->type = 0;
9377 6284 lex->slave_thd_opt= $3;
9378
2/2
✓ Branch 0 taken 661 times.
✓ Branch 1 taken 5623 times.
6284 if (lex->is_replication_deprecated_syntax_used())
9379
1/2
✓ Branch 0 taken 661 times.
✗ Branch 1 not taken.
661 push_deprecated_warn(YYTHD, "STOP SLAVE", "STOP REPLICA");
9380
2/4
✓ Branch 0 taken 6284 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6284 times.
6284 if (lex->set_channel_name($4))
9381 MYSQL_YYABORT; // OOM
9382 }
9383 ;
9384
9385 start_replica_stmt:
9386 START_SYM replica opt_replica_thread_option_list
9387 {
9388 7528 LEX *lex=Lex;
9389 /* Clean previous replica connection values */
9390
1/2
✓ Branch 0 taken 7528 times.
✗ Branch 1 not taken.
7528 lex->slave_connection.reset();
9391 7528 lex->sql_command = SQLCOM_SLAVE_START;
9392 7528 lex->type = 0;
9393 /* We'll use mi structure for UNTIL options */
9394
1/2
✓ Branch 0 taken 7528 times.
✗ Branch 1 not taken.
7528 lex->mi.set_unspecified();
9395 7528 lex->slave_thd_opt= $3;
9396
2/2
✓ Branch 0 taken 1204 times.
✓ Branch 1 taken 6324 times.
7528 if (lex->is_replication_deprecated_syntax_used())
9397
1/2
✓ Branch 0 taken 1204 times.
✗ Branch 1 not taken.
1204 push_deprecated_warn(YYTHD, "START SLAVE", "START REPLICA");
9398 }
9399 opt_replica_until
9400 opt_user_option opt_password_option
9401 opt_default_auth_option opt_plugin_dir_option
9402 {
9403 /*
9404 It is not possible to set user's information when
9405 one is trying to start the SQL Thread.
9406 */
9407
2/2
✓ Branch 0 taken 1116 times.
✓ Branch 1 taken 6397 times.
7513 if ((Lex->slave_thd_opt & SLAVE_SQL) == SLAVE_SQL &&
9408
2/2
✓ Branch 0 taken 1085 times.
✓ Branch 1 taken 31 times.
1116 (Lex->slave_thd_opt & SLAVE_IO) != SLAVE_IO &&
9409
2/2
✓ Branch 0 taken 1076 times.
✓ Branch 1 taken 9 times.
1085 (Lex->slave_connection.user ||
9410
1/2
✓ Branch 0 taken 1076 times.
✗ Branch 1 not taken.
1076 Lex->slave_connection.password ||
9411
1/2
✓ Branch 0 taken 1076 times.
✗ Branch 1 not taken.
1076 Lex->slave_connection.plugin_auth ||
9412
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1076 times.
1076 Lex->slave_connection.plugin_dir))
9413 {
9414
1/2
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
9 my_error(ER_SQLTHREAD_WITH_SECURE_SLAVE, MYF(0));
9415 9 MYSQL_YYABORT;
9416 }
9417 }
9418 opt_channel
9419 {
9420
2/4
✓ Branch 0 taken 7504 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7504 times.
7504 if (Lex->set_channel_name($11))
9421 MYSQL_YYABORT; // OOM
9422 }
9423 ;
9424
9425 start:
9426 START_SYM TRANSACTION_SYM opt_start_transaction_option_list
9427 {
9428 4925 LEX *lex= Lex;
9429 4925 lex->sql_command= SQLCOM_BEGIN;
9430 /* READ ONLY and READ WRITE are mutually exclusive. */
9431
2/2
✓ Branch 0 taken 13 times.
✓ Branch 1 taken 4912 times.
4925 if (($3 & MYSQL_START_TRANS_OPT_READ_WRITE) &&
9432
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 11 times.
13 ($3 & MYSQL_START_TRANS_OPT_READ_ONLY))
9433 {
9434
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 YYTHD->syntax_error();
9435 2 MYSQL_YYABORT;
9436 }
9437 4923 lex->start_transaction_opt= $3;
9438 }
9439 ;
9440
9441 opt_start_transaction_option_list:
9442 /* empty */
9443 {
9444 4745 $$= 0;
9445 }
9446 | start_transaction_option_list
9447 {
9448 180 $$= $1;
9449 }
9450 ;
9451
9452 start_transaction_option_list:
9453 start_transaction_option
9454 {
9455 180 $$= $1;
9456 }
9457 | start_transaction_option_list ',' start_transaction_option
9458 {
9459 10 $$= $1 | $3;
9460 }
9461 ;
9462
9463 start_transaction_option:
9464 WITH CONSISTENT_SYM SNAPSHOT_SYM
9465 {
9466 122 $$= MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT;
9467 }
9468 | WITH CONSISTENT_SYM SNAPSHOT_SYM FROM SESSION_SYM expr
9469 {
9470
7/14
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 26 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 26 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 26 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 26 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 26 times.
26 ITEMIZE($6, &$6);
9471
9472 26 $$= MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT;
9473 26 Lex->donor_transaction_id= $6;
9474 }
9475 | READ_SYM ONLY_SYM
9476 {
9477 29 $$= MYSQL_START_TRANS_OPT_READ_ONLY;
9478 }
9479 | READ_SYM WRITE_SYM
9480 {
9481 13 $$= MYSQL_START_TRANS_OPT_READ_WRITE;
9482 }
9483 ;
9484
9485 opt_user_option:
9486 {
9487 /* empty */
9488 }
9489 | USER EQ TEXT_STRING_sys
9490 {
9491 99 Lex->slave_connection.user= $3.str;
9492 }
9493 ;
9494
9495 opt_password_option:
9496 {
9497 /* empty */
9498 }
9499 | PASSWORD EQ TEXT_STRING_sys
9500 {
9501 99 Lex->slave_connection.password= $3.str;
9502 99 Lex->contains_plaintext_password= true;
9503 }
9504
9505 opt_default_auth_option:
9506 {
9507 /* empty */
9508 }
9509 | DEFAULT_AUTH_SYM EQ TEXT_STRING_sys
9510 {
9511 54 Lex->slave_connection.plugin_auth= $3.str;
9512 }
9513 ;
9514
9515 opt_plugin_dir_option:
9516 {
9517 /* empty */
9518 }
9519 | PLUGIN_DIR_SYM EQ TEXT_STRING_sys
9520 {
9521 45 Lex->slave_connection.plugin_dir= $3.str;
9522 }
9523 ;
9524
9525 opt_replica_thread_option_list:
9526 /* empty */
9527 {
9528 10623 $$= 0;
9529 }
9530 | replica_thread_option_list
9531 {
9532 3189 $$= $1;
9533 }
9534 ;
9535
9536 replica_thread_option_list:
9537 replica_thread_option
9538 {
9539 3189 $$= $1;
9540 }
9541 | replica_thread_option_list ',' replica_thread_option
9542 {
9543 31 $$= $1 | $3;
9544 }
9545 ;
9546
9547 replica_thread_option:
9548 SQL_THREAD
9549 {
9550 1862 $$= SLAVE_SQL;
9551 }
9552 | RELAY_THREAD
9553 {
9554 1358 $$= SLAVE_IO;
9555 }
9556 ;
9557
9558 opt_replica_until:
9559 /*empty*/
9560 {
9561 7379 LEX *lex= Lex;
9562 7379 lex->mi.slave_until= false;
9563 }
9564 | UNTIL_SYM replica_until
9565 {
9566 149 LEX *lex=Lex;
9567
4/4
✓ Branch 0 taken 80 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 77 times.
149 if (((lex->mi.log_file_name || lex->mi.pos) &&
9568
2/2
✓ Branch 0 taken 66 times.
✓ Branch 1 taken 6 times.
72 lex->mi.gtid) ||
9569
4/4
✓ Branch 0 taken 119 times.
✓ Branch 1 taken 24 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 116 times.
143 ((lex->mi.relay_log_name || lex->mi.relay_log_pos) &&
9570
1/2
✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
27 lex->mi.gtid) ||
9571
4/4
✓ Branch 0 taken 63 times.
✓ Branch 1 taken 80 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 60 times.
143 !((lex->mi.log_file_name && lex->mi.pos) ||
9572
4/4
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 59 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 18 times.
83 (lex->mi.relay_log_name && lex->mi.relay_log_pos) ||
9573
2/2
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 35 times.
65 lex->mi.gtid ||
9574
2/2
✓ Branch 0 taken 21 times.
✓ Branch 1 taken 9 times.
30 lex->mi.until_after_gaps) ||
9575 /* SQL_AFTER_MTS_GAPS is meaningless in combination */
9576 /* with any other coordinates related options */
9577
5/6
✓ Branch 0 taken 74 times.
✓ Branch 1 taken 60 times.
✓ Branch 2 taken 74 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 56 times.
✓ Branch 5 taken 18 times.
134 ((lex->mi.log_file_name || lex->mi.pos || lex->mi.relay_log_name
9578
3/4
✓ Branch 0 taken 56 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35 times.
✓ Branch 3 taken 21 times.
56 || lex->mi.relay_log_pos || lex->mi.gtid)
9579
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 113 times.
113 && lex->mi.until_after_gaps))
9580 {
9581
1/2
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
15 my_error(ER_BAD_SLAVE_UNTIL_COND, MYF(0));
9582 15 MYSQL_YYABORT;
9583 }
9584 134 lex->mi.slave_until= true;
9585 }
9586 ;
9587
9588 replica_until:
9589 source_file_def
9590 | replica_until ',' source_file_def
9591 | SQL_BEFORE_GTIDS EQ TEXT_STRING_sys
9592 {
9593 36 Lex->mi.gtid= $3.str;
9594 36 Lex->mi.gtid_until_condition= LEX_MASTER_INFO::UNTIL_SQL_BEFORE_GTIDS;
9595 }
9596 | SQL_AFTER_GTIDS EQ TEXT_STRING_sys
9597 {
9598 5 Lex->mi.gtid= $3.str;
9599 5 Lex->mi.gtid_until_condition= LEX_MASTER_INFO::UNTIL_SQL_AFTER_GTIDS;
9600 }
9601 | SQL_AFTER_MTS_GAPS
9602 {
9603 21 Lex->mi.until_after_gaps= true;
9604 }
9605 ;
9606
9607 checksum:
9608 CHECKSUM_SYM table_or_tables table_list opt_checksum_type
9609 {
9610 28214 LEX *lex=Lex;
9611 28214 lex->sql_command = SQLCOM_CHECKSUM;
9612 /* Will be overriden during execution. */
9613 28214 YYPS->m_lock_type= TL_UNLOCK;
9614
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 28214 times.
56428 if (Select->add_tables(YYTHD, $3, TL_OPTION_UPDATING,
9615
1/2
✓ Branch 0 taken 28214 times.
✗ Branch 1 not taken.
28214 YYPS->m_lock_type, YYPS->m_mdl_type))
9616 MYSQL_YYABORT;
9617 28214 Lex->check_opt.flags= $4;
9618 }
9619 ;
9620
9621 opt_checksum_type:
9622 28062 /* empty */ { $$= 0; }
9623 1 | QUICK { $$= T_QUICK; }
9624 151 | EXTENDED_SYM { $$= T_EXTEND; }
9625 ;
9626
9627 repair_table_stmt:
9628 REPAIR opt_no_write_to_binlog table_or_tables
9629 table_list opt_mi_repair_types
9630 {
9631
1/2
✓ Branch 0 taken 272 times.
✗ Branch 1 not taken.
544 $$= NEW_PTN PT_repair_table_stmt(YYMEM_ROOT, $2, $4,
9632
1/2
✓ Branch 0 taken 272 times.
✗ Branch 1 not taken.
544 $5.flags, $5.sql_flags);
9633 }
9634 ;
9635
9636 opt_mi_repair_types:
9637 204 /* empty */ { $$.flags = T_MEDIUM; $$.sql_flags= 0; }
9638 | mi_repair_types
9639 ;
9640
9641 mi_repair_types:
9642 mi_repair_type
9643 | mi_repair_types mi_repair_type
9644 {
9645 9 $$.flags= $1.flags | $2.flags;
9646 9 $$.sql_flags= $1.sql_flags | $2.sql_flags;
9647 }
9648 ;
9649
9650 mi_repair_type:
9651 15 QUICK { $$.flags= T_QUICK; $$.sql_flags= 0; }
9652 85 | EXTENDED_SYM { $$.flags= T_EXTEND; $$.sql_flags= 0; }
9653 22 | USE_FRM { $$.flags= 0; $$.sql_flags= TT_USEFRM; }
9654 ;
9655
9656 analyze_table_stmt:
9657 ANALYZE_SYM opt_no_write_to_binlog table_or_tables table_list
9658 opt_histogram
9659 {
9660
1/2
✓ Branch 0 taken 3789 times.
✗ Branch 1 not taken.
7578 $$= NEW_PTN PT_analyze_table_stmt(YYMEM_ROOT, $1, $2, $4,
9661 $5.command, $5.num_buckets,
9662
1/2
✓ Branch 0 taken 3789 times.
✗ Branch 1 not taken.
7578 $5.columns);
9663 }
9664 ;
9665
9666 opt_num_buckets:
9667 8 /* empty */ { $$= DEFAULT_NUMBER_OF_HISTOGRAM_BUCKETS; }
9668 | WITH NUM BUCKETS_SYM
9669 {
9670 int error;
9671
1/2
✓ Branch 0 taken 218 times.
✗ Branch 1 not taken.
218 longlong num= my_strtoll10($2.str, nullptr, &error);
9672
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 218 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
220 MYSQL_YYABORT_UNLESS(error <= 0);
9673
9674
4/4
✓ Branch 0 taken 217 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 216 times.
218 if (num < 1 || num > MAX_NUMBER_OF_HISTOGRAM_BUCKETS)
9675 {
9676
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_DATA_OUT_OF_RANGE, MYF(0), "Number of buckets",
9677 "ANALYZE TABLE");
9678 2 MYSQL_YYABORT;
9679 }
9680
9681 216 $$= num;
9682 }
9683 ;
9684
9685 opt_histogram:
9686 /* empty */
9687 {
9688 3548 $$.command= Sql_cmd_analyze_table::Histogram_command::NONE;
9689 3548 $$.columns= nullptr;
9690 3548 $$.num_buckets= 0;
9691 }
9692 | UPDATE_SYM HISTOGRAM_SYM ON_SYM ident_string_list opt_num_buckets
9693 {
9694 224 $$.command=
9695 Sql_cmd_analyze_table::Histogram_command::UPDATE_HISTOGRAM;
9696 224 $$.columns= $4;
9697 224 $$.num_buckets= $5;
9698 }
9699 | DROP HISTOGRAM_SYM ON_SYM ident_string_list
9700 {
9701 17 $$.command=
9702 Sql_cmd_analyze_table::Histogram_command::DROP_HISTOGRAM;
9703 17 $$.columns= $4;
9704 17 $$.num_buckets= 0;
9705 }
9706 ;
9707
9708 binlog_base64_event:
9709 BINLOG_SYM TEXT_STRING_sys
9710 {
9711 3467 Lex->sql_command = SQLCOM_BINLOG_BASE64_EVENT;
9712 3467 Lex->binlog_stmt_arg= $2;
9713 }
9714 ;
9715
9716 check_table_stmt:
9717 CHECK_SYM table_or_tables table_list opt_mi_check_types
9718 {
9719
1/2
✓ Branch 0 taken 2418 times.
✗ Branch 1 not taken.
4836 $$= NEW_PTN PT_check_table_stmt(YYMEM_ROOT, $1, $3,
9720
1/2
✓ Branch 0 taken 2418 times.
✗ Branch 1 not taken.
4836 $4.flags, $4.sql_flags);
9721 }
9722 ;
9723
9724 opt_mi_check_types:
9725 1601 /* empty */ { $$.flags = T_MEDIUM; $$.sql_flags= 0; }
9726 | mi_check_types
9727 ;
9728
9729 mi_check_types:
9730 mi_check_type
9731 | mi_check_type mi_check_types
9732 {
9733 $$.flags= $1.flags | $2.flags;
9734 $$.sql_flags= $1.sql_flags | $2.sql_flags;
9735 }
9736 ;
9737
9738 mi_check_type:
9739 QUICK
9740 6 { $$.flags= T_QUICK; $$.sql_flags= 0; }
9741 | FAST_SYM
9742 10 { $$.flags= T_FAST; $$.sql_flags= 0; }
9743 | MEDIUM_SYM
9744 8 { $$.flags= T_MEDIUM; $$.sql_flags= 0; }
9745 | EXTENDED_SYM
9746 338 { $$.flags= T_EXTEND; $$.sql_flags= 0; }
9747 | CHANGED
9748 10 { $$.flags= T_CHECK_ONLY_CHANGED; $$.sql_flags= 0; }
9749 | FOR_SYM UPGRADE_SYM
9750 480 { $$.flags= 0; $$.sql_flags= TT_FOR_UPGRADE; }
9751 ;
9752
9753 optimize_table_stmt:
9754 OPTIMIZE opt_no_write_to_binlog table_or_tables table_list
9755 {
9756
2/4
✓ Branch 0 taken 2253 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2253 times.
✗ Branch 3 not taken.
2253 $$= NEW_PTN PT_optimize_table_stmt(YYMEM_ROOT, $1, $2, $4);
9757 }
9758 ;
9759
9760 opt_no_write_to_binlog:
9761 31598 /* empty */ { $$= 0; }
9762 25 | NO_WRITE_TO_BINLOG { $$= 1; }
9763 78 | LOCAL_SYM { $$= 1; }
9764 ;
9765
9766 rename:
9767 RENAME table_or_tables
9768 {
9769 9828 Lex->sql_command= SQLCOM_RENAME_TABLE;
9770 }
9771 table_to_table_list
9772 {}
9773 | RENAME USER rename_list
9774 {
9775 506 Lex->sql_command = SQLCOM_RENAME_USER;
9776 }
9777 ;
9778
9779 rename_list:
9780 user TO_SYM user
9781 {
9782
5/10
✓ Branch 0 taken 506 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 506 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 506 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 506 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 506 times.
506 if (Lex->users_list.push_back($1) || Lex->users_list.push_back($3))
9783 MYSQL_YYABORT;
9784 }
9785 | rename_list ',' user TO_SYM user
9786 {
9787
5/10
✓ Branch 0 taken 55 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 55 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 55 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 55 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 55 times.
55 if (Lex->users_list.push_back($3) || Lex->users_list.push_back($5))
9788 MYSQL_YYABORT;
9789 }
9790 ;
9791
9792 table_to_table_list:
9793 table_to_table
9794 | table_to_table_list ',' table_to_table
9795 ;
9796
9797 table_to_table:
9798 table_ident TO_SYM table_ident
9799 {
9800 18293 LEX *lex=Lex;
9801 18293 Query_block *sl= Select;
9802
1/2
✓ Branch 0 taken 18293 times.
✗ Branch 1 not taken.
18293 if (!sl->add_table_to_list(lex->thd, $1,NULL,TL_OPTION_UPDATING,
9803
4/4
✓ Branch 0 taken 18279 times.
✓ Branch 1 taken 14 times.
✓ Branch 2 taken 23 times.
✓ Branch 3 taken 18270 times.
36572 TL_IGNORE, MDL_EXCLUSIVE) ||
9804
3/4
✓ Branch 0 taken 18279 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 18270 times.
18279 !sl->add_table_to_list(lex->thd, $3,NULL,TL_OPTION_UPDATING,
9805 TL_IGNORE, MDL_EXCLUSIVE))
9806 23 MYSQL_YYABORT;
9807 }
9808 ;
9809
9810 keycache_stmt:
9811 CACHE_SYM INDEX_SYM keycache_list IN_SYM key_cache_name
9812 {
9813
2/4
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
✗ Branch 3 not taken.
25 $$= NEW_PTN PT_cache_index_stmt(YYMEM_ROOT, $3, $5);
9814 }
9815 | CACHE_SYM INDEX_SYM table_ident adm_partition opt_cache_key_list
9816 IN_SYM key_cache_name
9817 {
9818
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
2 $$= NEW_PTN PT_cache_index_partitions_stmt(YYMEM_ROOT,
9819
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
3 $3, $4, $5, $7);
9820 }
9821 ;
9822
9823 keycache_list:
9824 assign_to_keycache
9825 {
9826
2/4
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
✗ Branch 3 not taken.
25 $$= NEW_PTN Mem_root_array<PT_assign_to_keycache *>(YYMEM_ROOT);
9827
4/8
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 25 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 25 times.
25 if ($$ == NULL || $$->push_back($1))
9828 MYSQL_YYABORT; // OOM
9829 }
9830 | keycache_list ',' assign_to_keycache
9831 {
9832 1 $$= $1;
9833
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if ($$->push_back($3))
9834 MYSQL_YYABORT; // OOM
9835 }
9836 ;
9837
9838 assign_to_keycache:
9839 table_ident opt_cache_key_list
9840 {
9841
2/4
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
✗ Branch 3 not taken.
26 $$= NEW_PTN PT_assign_to_keycache($1, $2);
9842 }
9843 ;
9844
9845 key_cache_name:
9846 23 ident { $$= to_lex_cstring($1); }
9847 3 | DEFAULT_SYM { $$ = default_key_cache_base; }
9848 ;
9849
9850 preload_stmt:
9851 LOAD INDEX_SYM INTO CACHE_SYM
9852 table_ident adm_partition opt_cache_key_list opt_ignore_leaves
9853 {
9854
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 $$= NEW_PTN PT_load_index_partitions_stmt(YYMEM_ROOT, $5,$6, $7, $8);
9855 }
9856 | LOAD INDEX_SYM INTO CACHE_SYM preload_list
9857 {
9858
2/4
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
✗ Branch 3 not taken.
28 $$= NEW_PTN PT_load_index_stmt(YYMEM_ROOT, $1, $5);
9859 }
9860 ;
9861
9862 preload_list:
9863 preload_keys
9864 {
9865
2/4
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
✗ Branch 3 not taken.
28 $$= NEW_PTN Mem_root_array<PT_preload_keys *>(YYMEM_ROOT);
9866
2/4
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 28 times.
28 if ($$->push_back($1))
9867 MYSQL_YYABORT; // OOM
9868 }
9869 | preload_list ',' preload_keys
9870 {
9871 9 $$= $1;
9872
4/8
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 9 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 9 times.
9 if ($$ == NULL || $$->push_back($3))
9873 MYSQL_YYABORT; // OOM
9874 }
9875 ;
9876
9877 preload_keys:
9878 table_ident opt_cache_key_list opt_ignore_leaves
9879 {
9880
2/4
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
✗ Branch 3 not taken.
37 $$= NEW_PTN PT_preload_keys($1, $2, $3);
9881 }
9882 ;
9883
9884 adm_partition:
9885 PARTITION_SYM '(' all_or_alt_part_name_list ')'
9886 {
9887
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 $$= NEW_PTN PT_adm_partition($3);
9888 }
9889 ;
9890
9891 opt_cache_key_list:
9892 55 /* empty */ { $$= NULL; }
9893 | key_or_index '(' opt_key_usage_list ')'
9894 {
9895
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
✓ Branch 2 taken 11 times.
✗ Branch 3 not taken.
11 init_index_hints($3, INDEX_HINT_USE,
9896 old_mode ? INDEX_HINT_MASK_JOIN
9897 : INDEX_HINT_MASK_ALL);
9898 11 $$= $3;
9899 }
9900 ;
9901
9902 opt_ignore_leaves:
9903 25 /* empty */ { $$= false; }
9904 14 | IGNORE_SYM LEAVES { $$= true; }
9905 ;
9906
9907 select_stmt:
9908 query_expression
9909 {
9910
1/2
✓ Branch 0 taken 9898674 times.
✗ Branch 1 not taken.
9898671 $$ = NEW_PTN PT_select_stmt($1);
9911 }
9912 | query_expression locking_clause_list
9913 {
9914
3/6
✓ Branch 0 taken 2056 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2056 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2056 times.
✗ Branch 5 not taken.
6168 $$ = NEW_PTN PT_select_stmt(NEW_PTN PT_locking($1, $2),
9915 4112 nullptr, true);
9916 }
9917 | query_expression_parens
9918 {
9919
1/2
✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
200 $$ = NEW_PTN PT_select_stmt($1);
9920 }
9921 | select_stmt_with_into
9922 ;
9923
9924 /*
9925 MySQL has a syntax extension that allows into clauses in any one of two
9926 places. They may appear either before the from clause or at the end. All in
9927 a top-level select statement. This extends the standard syntax in two
9928 ways. First, we don't have the restriction that the result can contain only
9929 one row: the into clause might be INTO OUTFILE/DUMPFILE in which case any
9930 number of rows is allowed. Hence MySQL does not have any special case for
9931 the standard's <select statement: single row>. Secondly, and this has more
9932 severe implications for the parser, it makes the grammar ambiguous, because
9933 in a from-clause-less select statement with an into clause, it is not clear
9934 whether the into clause is the leading or the trailing one.
9935
9936 While it's possible to write an unambiguous grammar, it would force us to
9937 duplicate the entire <select statement> syntax all the way down to the <into
9938 clause>. So instead we solve it by writing an ambiguous grammar and use
9939 precedence rules to sort out the shift/reduce conflict.
9940
9941 The problem is when the parser has seen SELECT <select list>, and sees an
9942 INTO token. It can now either shift it or reduce what it has to a table-less
9943 query expression. If it shifts the token, it will accept seeing a FROM token
9944 next and hence the INTO will be interpreted as the leading INTO. If it
9945 reduces what it has seen to a table-less select, however, it will interpret
9946 INTO as the trailing into. But what if the next token is FROM? Obviously,
9947 we want to always shift INTO. We do this by two precedence declarations: We
9948 make the INTO token right-associative, and we give it higher precedence than
9949 an empty from clause, using the artificial token EMPTY_FROM_CLAUSE.
9950
9951 The remaining problem is that now we allow the leading INTO anywhere, when
9952 it should be allowed on the top level only. We solve this by manually
9953 throwing parse errors whenever we reduce a nested query expression if it
9954 contains an into clause.
9955 */
9956 select_stmt_with_into:
9957 '(' select_stmt_with_into ')'
9958 {
9959 9 $$ = $2;
9960 }
9961 | query_expression into_clause
9962 {
9963
1/2
✓ Branch 0 taken 25738 times.
✗ Branch 1 not taken.
25738 $$ = NEW_PTN PT_select_stmt($1, $2);
9964 }
9965 | query_expression into_clause locking_clause_list
9966 {
9967
3/6
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 $$ = NEW_PTN PT_select_stmt(NEW_PTN PT_locking($1, $3), $2, true);
9968 }
9969 | query_expression locking_clause_list into_clause
9970 {
9971
3/6
✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
32 $$ = NEW_PTN PT_select_stmt(NEW_PTN PT_locking($1, $2), $3);
9972 }
9973 | query_expression_parens into_clause
9974 {
9975
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 $$ = NEW_PTN PT_select_stmt($1, $2);
9976 }
9977 ;
9978
9979 /**
9980 A <query_expression> within parentheses can be used as an <expr>. Now,
9981 because both a <query_expression> and an <expr> can appear syntactically
9982 within any number of parentheses, we get an ambiguous grammar: Where do the
9983 parentheses belong? Techically, we have to tell Bison by which rule to
9984 reduce the extra pair of parentheses. We solve it in a somewhat tedious way
9985 by defining a query_expression so that it can't have enclosing
9986 parentheses. This forces us to be very explicit about exactly where we allow
9987 parentheses; while the standard defines only one rule for <query expression>
9988 parentheses, we have to do it in several places. But this is a blessing in
9989 disguise, as we are able to define our syntax in a more fine-grained manner,
9990 and this is necessary in order to support some MySQL extensions, for example
9991 as in the last two sub-rules here.
9992
9993 Even if we define a query_expression not to have outer parentheses, we still
9994 get a shift/reduce conflict for the <subquery> rule, but we solve this by
9995 using an artifical token SUBQUERY_AS_EXPR that has less priority than
9996 parentheses. This ensures that the parser consumes as many parentheses as it
9997 can, and only when that fails will it try to reduce, and by then it will be
9998 clear from the lookahead token whether we have a subquery or just a
9999 query_expression within parentheses. For example, if the lookahead token is
10000 UNION it's just a query_expression within parentheses and the parentheses
10001 don't mean it's a subquery. If the next token is PLUS, we know it must be an
10002 <expr> and the parentheses really mean it's a subquery.
10003
10004 A word about CTE's: The rules below are duplicated, one with a with_clause
10005 and one without, instead of using a single rule with an opt_with_clause. The
10006 reason we do this is because it would make Bison try to cram both rules into
10007 a single state, where it would have to decide whether to reduce a with_clause
10008 before seeing the rest of the input. This way we force Bison to parse the
10009 entire query expression before trying to reduce.
10010 */
10011 query_expression:
10012 query_expression_body
10013 opt_order_clause
10014 opt_limit_clause
10015 {
10016
2/4
✓ Branch 0 taken 10305412 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10305422 times.
✗ Branch 3 not taken.
10305409 $$ = NEW_PTN PT_query_expression($1, $2, $3);
10017 }
10018 | with_clause
10019 query_expression_body
10020 opt_order_clause
10021 opt_limit_clause
10022 {
10023
2/4
✓ Branch 0 taken 5733 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5733 times.
✗ Branch 3 not taken.
5733 $$= NEW_PTN PT_query_expression($1, $2, $3, $4);
10024 }
10025 | query_expression_parens
10026 order_clause
10027 opt_limit_clause
10028 {
10029
2/4
✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
126 $$= NEW_PTN PT_query_expression($1, $2, $3);
10030 }
10031 | with_clause
10032 query_expression_parens
10033 order_clause
10034 opt_limit_clause
10035 {
10036
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 $$= NEW_PTN PT_query_expression($1, $2, $3, $4);
10037 }
10038 | query_expression_parens
10039 limit_clause
10040 {
10041
2/4
✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29 times.
✗ Branch 3 not taken.
29 $$ = NEW_PTN PT_query_expression($1, nullptr, $2);
10042 }
10043 | with_clause
10044 query_expression_parens
10045 limit_clause
10046 {
10047
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 $$ = NEW_PTN PT_query_expression($1, $2, nullptr, $3);
10048 }
10049 | with_clause
10050 query_expression_parens
10051 {
10052
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 $$ = NEW_PTN PT_query_expression($1, $2, nullptr, nullptr);
10053 }
10054 ;
10055
10056 query_expression_body:
10057 query_primary
10058 {
10059 10305998 $$ = $1;
10060 }
10061 | query_expression_body UNION_SYM union_option query_primary
10062 {
10063
2/4
✓ Branch 0 taken 53431 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 53431 times.
✗ Branch 3 not taken.
53431 $$ = NEW_PTN PT_union($1, @1, $3, $4);
10064 }
10065 | query_expression_parens UNION_SYM union_option query_primary
10066 {
10067
2/4
✓ Branch 0 taken 1877 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
✗ Branch 3 not taken.
1877 $$ = NEW_PTN PT_union($1, @1, $3, $4);
10068 }
10069 | query_expression_body UNION_SYM union_option query_expression_parens
10070 {
10071
2/4
✓ Branch 0 taken 4587 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4587 times.
✗ Branch 3 not taken.
4587 $$ = NEW_PTN PT_union($1, @1, $3, $4, true);
10072 }
10073 | query_expression_parens UNION_SYM union_option query_expression_parens
10074 {
10075
2/4
✓ Branch 0 taken 3277 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3277 times.
✗ Branch 3 not taken.
3277 $$ = NEW_PTN PT_union($1, @1, $3, $4, true);
10076 }
10077 ;
10078
10079
10080 query_expression_parens:
10081 419 '(' query_expression_parens ')' { $$= $2; }
10082 266369 | '(' query_expression')' { $$= $2; }
10083 | '(' query_expression locking_clause_list')'
10084 {
10085
2/4
✓ Branch 0 taken 144 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 144 times.
✗ Branch 3 not taken.
144 $$ = NEW_PTN PT_locking($2, $3);
10086 }
10087 ;
10088
10089 query_primary:
10090 query_specification
10091 {
10092 // Bison doesn't get polymorphism.
10093 10361125 $$= $1;
10094 }
10095 | table_value_constructor
10096 {
10097
2/4
✓ Branch 0 taken 169 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 169 times.
✗ Branch 3 not taken.
169 $$= NEW_PTN PT_table_value_constructor($1);
10098 }
10099 | explicit_table
10100 {
10101
2/4
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
✗ Branch 3 not taken.
13 auto item_list= NEW_PTN PT_select_item_list;
10102
2/4
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
✗ Branch 3 not taken.
13 auto asterisk= NEW_PTN Item_asterisk(@$, nullptr, nullptr);
10103
3/6
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 13 times.
26 if (item_list == nullptr || asterisk == nullptr ||
10104
2/4
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 13 times.
13 item_list->push_back(asterisk))
10105 MYSQL_YYABORT;
10106
2/4
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
✗ Branch 3 not taken.
13 $$= NEW_PTN PT_explicit_table({}, item_list, $1);
10107 }
10108 ;
10109
10110 query_specification:
10111 SELECT_SYM
10112 select_options
10113 select_item_list
10114 into_clause
10115 opt_from_clause
10116 opt_where_clause
10117 opt_group_clause
10118 opt_having_clause
10119 opt_window_clause
10120 {
10121
1/2
✓ Branch 0 taken 109813 times.
✗ Branch 1 not taken.
219626 $$= NEW_PTN PT_query_specification(
10122 109813 $1, // SELECT_SYM
10123 109813 $2, // select_options
10124 109813 $3, // select_item_list
10125 109813 $4, // into_clause
10126 109813 $5, // from
10127 109813 $6, // where
10128 109813 $7, // group
10129 109813 $8, // having
10130 $9, // windows
10131
2/4
✓ Branch 0 taken 109811 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 109813 times.
✗ Branch 3 not taken.
219624 @5.raw.is_empty()); // implicit FROM
10132 }
10133 | SELECT_SYM
10134 select_options
10135 select_item_list
10136 opt_from_clause
10137 opt_where_clause
10138 opt_group_clause
10139 opt_having_clause
10140 opt_window_clause
10141 {
10142
1/2
✓ Branch 0 taken 10251320 times.
✗ Branch 1 not taken.
20502640 $$= NEW_PTN PT_query_specification(
10143 10251320 $1, // SELECT_SYM
10144 10251320 $2, // select_options
10145 10251320 $3, // select_item_list
10146 NULL,// no INTO clause
10147 10251320 $4, // from
10148 10251320 $5, // where
10149 10251320 $6, // group
10150 10251320 $7, // having
10151 $8, // windows
10152
2/4
✓ Branch 0 taken 10251314 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10251320 times.
✗ Branch 3 not taken.
20502637 @4.raw.is_empty()); // implicit FROM
10153 }
10154 ;
10155
10156 opt_from_clause:
10157 8064000 /* Empty. */ %prec EMPTY_FROM_CLAUSE { $$.init(YYMEM_ROOT); }
10158 | from_clause
10159 ;
10160
10161 from_clause:
10162 2297135 FROM from_tables { $$= $2; }
10163 ;
10164
10165 from_tables:
10166 528 DUAL_SYM { $$.init(YYMEM_ROOT); }
10167 | table_reference_list
10168 ;
10169
10170 table_reference_list:
10171 table_reference
10172 {
10173 2658719 $$.init(YYMEM_ROOT);
10174
2/4
✓ Branch 0 taken 2658720 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2658720 times.
2658716 if ($$.push_back($1))
10175 MYSQL_YYABORT; // OOM
10176 }
10177 | table_reference_list ',' table_reference
10178 {
10179 76913 $$= $1;
10180
2/4
✓ Branch 0 taken 76913 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 76913 times.
76913 if ($$.push_back($3))
10181 MYSQL_YYABORT; // OOM
10182 }
10183 ;
10184
10185 table_value_constructor:
10186 VALUES values_row_list
10187 {
10188 169 $$= $2;
10189 }
10190 ;
10191
10192 explicit_table:
10193 TABLE_SYM table_ident
10194 {
10195 13 $$.init(YYMEM_ROOT);
10196 auto table= NEW_PTN
10197
2/4
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
✗ Branch 3 not taken.
13 PT_table_factor_table_ident($2, nullptr, NULL_CSTR, nullptr);
10198
2/4
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 13 times.
13 if ($$.push_back(table))
10199 MYSQL_YYABORT; // OOM
10200 }
10201 ;
10202
10203 select_options:
10204 /* empty*/
10205 {
10206 10349436 $$.query_spec_options= 0;
10207 }
10208 | select_option_list
10209 ;
10210
10211 select_option_list:
10212 select_option_list select_option
10213 {
10214
2/4
✓ Branch 0 taken 84 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 84 times.
84 if ($$.merge($1, $2))
10215 MYSQL_YYABORT;
10216 }
10217 | select_option
10218 ;
10219
10220 select_option:
10221 query_spec_option
10222 {
10223 11032 $$.query_spec_options= $1;
10224 }
10225 | SQL_NO_CACHE_SYM
10226 {
10227
1/2
✓ Branch 0 taken 1143 times.
✗ Branch 1 not taken.
1143 push_deprecated_warn_no_replacement(YYTHD, "SQL_NO_CACHE");
10228 /* Ignored since MySQL 8.0. */
10229 1143 $$.query_spec_options= 0;
10230 }
10231 ;
10232
10233 locking_clause_list:
10234 locking_clause_list locking_clause
10235 {
10236 78 $$= $1;
10237
2/4
✓ Branch 0 taken 78 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 78 times.
78 if ($$->push_back($2))
10238 MYSQL_YYABORT; // OOM
10239 }
10240 | locking_clause
10241 {
10242
2/4
✓ Branch 0 taken 2260 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2260 times.
✗ Branch 3 not taken.
2260 $$= NEW_PTN PT_locking_clause_list(YYTHD->mem_root);
10243
4/8
✓ Branch 0 taken 2260 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2260 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2260 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2260 times.
2260 if ($$ == nullptr || $$->push_back($1))
10244 MYSQL_YYABORT; // OOM
10245 }
10246 ;
10247
10248 locking_clause:
10249 FOR_SYM lock_strength opt_locked_row_action
10250 {
10251
2/4
✓ Branch 0 taken 1736 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1736 times.
✗ Branch 3 not taken.
1736 $$= NEW_PTN PT_query_block_locking_clause($2, $3);
10252 }
10253 | FOR_SYM lock_strength table_locking_list opt_locked_row_action
10254 {
10255
2/4
✓ Branch 0 taken 289 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 289 times.
✗ Branch 3 not taken.
289 $$= NEW_PTN PT_table_locking_clause($2, $3, $4);
10256 }
10257 | LOCK_SYM IN_SYM SHARE_SYM MODE_SYM
10258 {
10259
2/4
✓ Branch 0 taken 313 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 313 times.
✗ Branch 3 not taken.
313 $$= NEW_PTN PT_query_block_locking_clause(Lock_strength::SHARE);
10260 }
10261 ;
10262
10263 lock_strength:
10264 1652 UPDATE_SYM { $$= Lock_strength::UPDATE; }
10265 373 | SHARE_SYM { $$= Lock_strength::SHARE; }
10266 ;
10267
10268 table_locking_list:
10269 289 OF_SYM table_alias_ref_list { $$= $2; }
10270 ;
10271
10272 opt_locked_row_action:
10273 1707 /* Empty */ { $$= Locked_row_action::WAIT; }
10274 | locked_row_action
10275 ;
10276
10277 locked_row_action:
10278 154 SKIP_SYM LOCKED_SYM { $$= Locked_row_action::SKIP; }
10279 164 | NOWAIT_SYM { $$= Locked_row_action::NOWAIT; }
10280 ;
10281
10282 select_item_list:
10283 select_item_list ',' select_item
10284 {
10285
4/8
✓ Branch 0 taken 12592675 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12592680 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 12592680 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 12592680 times.
12592675 if ($1 == NULL || $1->push_back($3))
10286 MYSQL_YYABORT;
10287 12592680 $$= $1;
10288 }
10289 | select_item
10290 {
10291
2/4
✓ Branch 0 taken 9808227 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9808231 times.
✗ Branch 3 not taken.
9808226 $$= NEW_PTN PT_select_item_list;
10292
4/8
✓ Branch 0 taken 9808232 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9808231 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 9808231 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 9808230 times.
9808231 if ($$ == NULL || $$->push_back($1))
10293 MYSQL_YYABORT;
10294 }
10295 | '*'
10296 {
10297
2/4
✓ Branch 0 taken 568081 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 568081 times.
✗ Branch 3 not taken.
568081 Item *item = NEW_PTN Item_asterisk(@$, nullptr, nullptr);
10298
2/4
✓ Branch 0 taken 568081 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 568081 times.
✗ Branch 3 not taken.
568081 $$ = NEW_PTN PT_select_item_list;
10299
5/10
✓ Branch 0 taken 568081 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 568081 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 568081 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 568081 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 568081 times.
568081 if ($$ == nullptr || item == nullptr || $$->push_back(item))
10300 MYSQL_YYABORT;
10301 }
10302 ;
10303
10304 select_item:
10305 4119 table_wild { $$= $1; }
10306 | expr select_alias
10307 {
10308
2/4
✓ Branch 0 taken 22396777 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 22396790 times.
✗ Branch 3 not taken.
22396786 $$= NEW_PTN PTI_expr_with_alias(@$, $1, @1.cpp, to_lex_cstring($2));
10309 }
10310 ;
10311
10312
10313 select_alias:
10314 36797349 /* empty */ { $$=null_lex_str;}
10315 10920237 | AS ident { $$=$2; }
10316 74394 | AS TEXT_STRING_validated { $$=$2; }
10317 79798 | ident { $$=$1; }
10318 4131 | TEXT_STRING_validated { $$=$1; }
10319 ;
10320
10321 optional_braces:
10322 /* empty */ {}
10323 | '(' ')' {}
10324 ;
10325
10326 /* all possible expressions */
10327 expr:
10328 expr or expr %prec OR_SYM
10329 {
10330 1092967 $$= flatten_associative_operator<Item_cond_or,
10331 1092967 Item_func::COND_OR_FUNC>(
10332
1/2
✓ Branch 0 taken 1092967 times.
✗ Branch 1 not taken.
1092967 YYMEM_ROOT, @$, $1, $3);
10333 }
10334 | expr XOR expr %prec XOR
10335 {
10336 /* XOR is a proprietary extension */
10337
2/4
✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✗ Branch 3 not taken.
133 $$ = NEW_PTN Item_func_xor(@$, $1, $3);
10338 }
10339 | expr and expr %prec AND_SYM
10340 {
10341 2611406 $$= flatten_associative_operator<Item_cond_and,
10342 2611406 Item_func::COND_AND_FUNC>(
10343
1/2
✓ Branch 0 taken 2611406 times.
✗ Branch 1 not taken.
2611406 YYMEM_ROOT, @$, $1, $3);
10344 }
10345 | NOT_SYM expr %prec NOT_SYM
10346 {
10347
2/4
✓ Branch 0 taken 35373 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35373 times.
✗ Branch 3 not taken.
35373 $$= NEW_PTN PTI_truth_transform(@$, $2, Item::BOOL_NEGATED);
10348 }
10349 | bool_pri IS TRUE_SYM %prec IS
10350 {
10351
2/4
✓ Branch 0 taken 90 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 90 times.
✗ Branch 3 not taken.
90 $$= NEW_PTN PTI_truth_transform(@$, $1, Item::BOOL_IS_TRUE);
10352 }
10353 | bool_pri IS not TRUE_SYM %prec IS
10354 {
10355
2/4
✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 34 times.
✗ Branch 3 not taken.
34 $$= NEW_PTN PTI_truth_transform(@$, $1, Item::BOOL_NOT_TRUE);
10356 }
10357 | bool_pri IS FALSE_SYM %prec IS
10358 {
10359
2/4
✓ Branch 0 taken 94295 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 94295 times.
✗ Branch 3 not taken.
94295 $$= NEW_PTN PTI_truth_transform(@$, $1, Item::BOOL_IS_FALSE);
10360 }
10361 | bool_pri IS not FALSE_SYM %prec IS
10362 {
10363
2/4
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
18 $$= NEW_PTN PTI_truth_transform(@$, $1, Item::BOOL_NOT_FALSE);
10364 }
10365 | bool_pri IS UNKNOWN_SYM %prec IS
10366 {
10367
2/4
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
✗ Branch 3 not taken.
26 $$= NEW_PTN Item_func_isnull(@$, $1);
10368 }
10369 | bool_pri IS not UNKNOWN_SYM %prec IS
10370 {
10371
2/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
8 $$= NEW_PTN Item_func_isnotnull(@$, $1);
10372 }
10373 | bool_pri %prec SET_VAR
10374 ;
10375
10376 bool_pri:
10377 bool_pri IS NULL_SYM %prec IS
10378 {
10379
2/4
✓ Branch 0 taken 1244051 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1244051 times.
✗ Branch 3 not taken.
1244051 $$= NEW_PTN Item_func_isnull(@$, $1);
10380 }
10381 | bool_pri IS not NULL_SYM %prec IS
10382 {
10383
2/4
✓ Branch 0 taken 94005 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 94005 times.
✗ Branch 3 not taken.
94005 $$= NEW_PTN Item_func_isnotnull(@$, $1);
10384 }
10385 | bool_pri comp_op predicate
10386 {
10387
2/4
✓ Branch 0 taken 13674394 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13674411 times.
✗ Branch 3 not taken.
13674397 $$= NEW_PTN PTI_comp_op(@$, $1, $2, $3);
10388 }
10389 | bool_pri comp_op all_or_any table_subquery %prec EQ
10390 {
10391
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 343 times.
344 if ($2 == &comp_equal_creator)
10392 /*
10393 We throw this manual parse error rather than split the rule
10394 comp_op into a null-safe and a non null-safe rule, since doing
10395 so would add a shift/reduce conflict. It's actually this rule
10396 and the ones referencing it that cause all the conflicts, but
10397 we still don't want the count to go up.
10398 */
10399
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 YYTHD->syntax_error_at(@2);
10400
2/4
✓ Branch 0 taken 344 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 344 times.
✗ Branch 3 not taken.
344 $$= NEW_PTN PTI_comp_op_all(@$, $1, $2, $3, $4);
10401 }
10402 | predicate %prec SET_VAR
10403 ;
10404
10405 predicate:
10406 bit_expr IN_SYM table_subquery
10407 {
10408
2/4
✓ Branch 0 taken 12454 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12454 times.
✗ Branch 3 not taken.
12454 $$= NEW_PTN Item_in_subselect(@$, $1, $3);
10409 }
10410 | bit_expr not IN_SYM table_subquery
10411 {
10412
2/4
✓ Branch 0 taken 2621 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2621 times.
✗ Branch 3 not taken.
2621 Item *item= NEW_PTN Item_in_subselect(@$, $1, $4);
10413
2/4
✓ Branch 0 taken 2621 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2621 times.
✗ Branch 3 not taken.
2621 $$= NEW_PTN PTI_truth_transform(@$, item, Item::BOOL_NEGATED);
10414 }
10415 | bit_expr IN_SYM '(' expr ')'
10416 {
10417
2/4
✓ Branch 0 taken 5880 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5880 times.
✗ Branch 3 not taken.
5880 $$= NEW_PTN PTI_handle_sql2003_note184_exception(@$, $1, true, $4);
10418 }
10419 | bit_expr IN_SYM '(' expr ',' expr_list ')'
10420 {
10421
6/12
✓ Branch 0 taken 131487 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 131487 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 131487 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 131487 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 131487 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 131487 times.
131487 if ($6 == NULL || $6->push_front($4) || $6->push_front($1))
10422 MYSQL_YYABORT;
10423
10424
2/4
✓ Branch 0 taken 131487 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 131487 times.
✗ Branch 3 not taken.
131487 $$= NEW_PTN Item_func_in(@$, $6, false);
10425 }
10426 | bit_expr not IN_SYM '(' expr ')'
10427 {
10428
2/4
✓ Branch 0 taken 29003 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29003 times.
✗ Branch 3 not taken.
29003 $$= NEW_PTN PTI_handle_sql2003_note184_exception(@$, $1, false, $5);
10429 }
10430 | bit_expr not IN_SYM '(' expr ',' expr_list ')'
10431 {
10432
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 212246 times.
212246 if ($7 == nullptr)
10433 MYSQL_YYABORT;
10434
1/2
✓ Branch 0 taken 212246 times.
✗ Branch 1 not taken.
212246 $7->push_front($5);
10435
1/2
✓ Branch 0 taken 212246 times.
✗ Branch 1 not taken.
212246 $7->value.push_front($1);
10436
10437
2/4
✓ Branch 0 taken 212246 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 212246 times.
✗ Branch 3 not taken.
212246 $$= NEW_PTN Item_func_in(@$, $7, true);
10438 }
10439 | bit_expr MEMBER_SYM opt_of '(' simple_expr ')'
10440 {
10441
2/4
✓ Branch 0 taken 504 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 504 times.
✗ Branch 3 not taken.
504 $$= NEW_PTN Item_func_member_of(@$, $1, $5);
10442 }
10443 | bit_expr BETWEEN_SYM bit_expr AND_SYM predicate
10444 {
10445
2/4
✓ Branch 0 taken 16676 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16676 times.
✗ Branch 3 not taken.
16676 $$= NEW_PTN Item_func_between(@$, $1, $3, $5, false);
10446 }
10447 | bit_expr not BETWEEN_SYM bit_expr AND_SYM predicate
10448 {
10449
2/4
✓ Branch 0 taken 193 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 193 times.
✗ Branch 3 not taken.
193 $$= NEW_PTN Item_func_between(@$, $1, $4, $6, true);
10450 }
10451 | bit_expr SOUNDS_SYM LIKE bit_expr
10452 {
10453
2/4
✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
✗ Branch 3 not taken.
32 Item *item1= NEW_PTN Item_func_soundex(@$, $1);
10454
2/4
✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
✗ Branch 3 not taken.
32 Item *item4= NEW_PTN Item_func_soundex(@$, $4);
10455
2/4
✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 32 times.
32 if ((item1 == NULL) || (item4 == NULL))
10456 MYSQL_YYABORT;
10457
2/4
✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
✗ Branch 3 not taken.
32 $$= NEW_PTN Item_func_eq(@$, item1, item4);
10458 }
10459 | bit_expr LIKE simple_expr
10460 {
10461
2/4
✓ Branch 0 taken 140054 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 140054 times.
✗ Branch 3 not taken.
140054 $$ = NEW_PTN Item_func_like(@$, $1, $3);
10462 }
10463 | bit_expr LIKE simple_expr ESCAPE_SYM simple_expr %prec LIKE
10464 {
10465
2/4
✓ Branch 0 taken 18668 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18668 times.
✗ Branch 3 not taken.
18668 $$ = NEW_PTN Item_func_like(@$, $1, $3, $5);
10466 }
10467 | bit_expr not LIKE simple_expr
10468 {
10469
2/4
✓ Branch 0 taken 177497 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 177497 times.
✗ Branch 3 not taken.
177497 auto item = NEW_PTN Item_func_like(@$, $1, $4);
10470
2/4
✓ Branch 0 taken 177497 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 177497 times.
✗ Branch 3 not taken.
177497 $$ = NEW_PTN Item_func_not(@$, item);
10471 }
10472 | bit_expr not LIKE simple_expr ESCAPE_SYM simple_expr %prec LIKE
10473 {
10474
2/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
8 auto item = NEW_PTN Item_func_like(@$, $1, $4, $6);
10475
2/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
8 $$ = NEW_PTN Item_func_not(@$, item);
10476 }
10477 | bit_expr REGEXP bit_expr
10478 {
10479
2/4
✓ Branch 0 taken 122100 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 122102 times.
✗ Branch 3 not taken.
122100 auto args= NEW_PTN PT_item_list;
10480
1/2
✓ Branch 0 taken 122102 times.
✗ Branch 1 not taken.
122102 args->push_back($1);
10481
1/2
✓ Branch 0 taken 122102 times.
✗ Branch 1 not taken.
122102 args->push_back($3);
10482
10483
2/4
✓ Branch 0 taken 122102 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 122102 times.
✗ Branch 3 not taken.
122102 $$= NEW_PTN Item_func_regexp_like(@1, args);
10484 }
10485 | bit_expr not REGEXP bit_expr
10486 {
10487
2/4
✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 74 times.
✗ Branch 3 not taken.
74 auto args= NEW_PTN PT_item_list;
10488
1/2
✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
74 args->push_back($1);
10489
1/2
✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
74 args->push_back($4);
10490
2/4
✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 74 times.
✗ Branch 3 not taken.
74 Item *item= NEW_PTN Item_func_regexp_like(@$, args);
10491
2/4
✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 74 times.
✗ Branch 3 not taken.
74 $$= NEW_PTN PTI_truth_transform(@$, item, Item::BOOL_NEGATED);
10492 }
10493 | bit_expr %prec SET_VAR
10494 ;
10495
10496 opt_of:
10497 OF_SYM
10498 |
10499 ;
10500
10501 bit_expr:
10502 bit_expr '|' bit_expr %prec '|'
10503 {
10504
2/4
✓ Branch 0 taken 2673 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2673 times.
✗ Branch 3 not taken.
2673 $$= NEW_PTN Item_func_bit_or(@$, $1, $3);
10505 }
10506 | bit_expr '&' bit_expr %prec '&'
10507 {
10508
2/4
✓ Branch 0 taken 27955 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 27955 times.
✗ Branch 3 not taken.
27955 $$= NEW_PTN Item_func_bit_and(@$, $1, $3);
10509 }
10510 | bit_expr SHIFT_LEFT bit_expr %prec SHIFT_LEFT
10511 {
10512
2/4
✓ Branch 0 taken 34890 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 34890 times.
✗ Branch 3 not taken.
34890 $$= NEW_PTN Item_func_shift_left(@$, $1, $3);
10513 }
10514 | bit_expr SHIFT_RIGHT bit_expr %prec SHIFT_RIGHT
10515 {
10516
2/4
✓ Branch 0 taken 26396 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 26396 times.
✗ Branch 3 not taken.
26396 $$= NEW_PTN Item_func_shift_right(@$, $1, $3);
10517 }
10518 | bit_expr '+' bit_expr %prec '+'
10519 {
10520
2/4
✓ Branch 0 taken 1416019 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1416034 times.
✗ Branch 3 not taken.
1416019 $$= NEW_PTN Item_func_plus(@$, $1, $3);
10521 }
10522 | bit_expr '-' bit_expr %prec '-'
10523 {
10524
2/4
✓ Branch 0 taken 1008301 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1008301 times.
✗ Branch 3 not taken.
1008301 $$= NEW_PTN Item_func_minus(@$, $1, $3);
10525 }
10526 | bit_expr '+' INTERVAL_SYM expr interval %prec '+'
10527 {
10528
2/4
✓ Branch 0 taken 463 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 463 times.
✗ Branch 3 not taken.
463 $$= NEW_PTN Item_date_add_interval(@$, $1, $4, $5, 0);
10529 }
10530 | bit_expr '-' INTERVAL_SYM expr interval %prec '-'
10531 {
10532
2/4
✓ Branch 0 taken 73 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 73 times.
✗ Branch 3 not taken.
73 $$= NEW_PTN Item_date_add_interval(@$, $1, $4, $5, 1);
10533 }
10534 | bit_expr '*' bit_expr %prec '*'
10535 {
10536
2/4
✓ Branch 0 taken 381745 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 381745 times.
✗ Branch 3 not taken.
381745 $$= NEW_PTN Item_func_mul(@$, $1, $3);
10537 }
10538 | bit_expr '/' bit_expr %prec '/'
10539 {
10540
2/4
✓ Branch 0 taken 697382 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 697382 times.
✗ Branch 3 not taken.
697382 $$= NEW_PTN Item_func_div(@$, $1,$3);
10541 }
10542 | bit_expr '%' bit_expr %prec '%'
10543 {
10544
2/4
✓ Branch 0 taken 7713 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7713 times.
✗ Branch 3 not taken.
7714 $$= NEW_PTN Item_func_mod(@$, $1,$3);
10545 }
10546 | bit_expr DIV_SYM bit_expr %prec DIV_SYM
10547 {
10548
2/4
✓ Branch 0 taken 849650 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 849650 times.
✗ Branch 3 not taken.
849650 $$= NEW_PTN Item_func_div_int(@$, $1,$3);
10549 }
10550 | bit_expr MOD_SYM bit_expr %prec MOD_SYM
10551 {
10552
2/4
✓ Branch 0 taken 127012 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 127012 times.
✗ Branch 3 not taken.
127012 $$= NEW_PTN Item_func_mod(@$, $1, $3);
10553 }
10554 | bit_expr '^' bit_expr
10555 {
10556
2/4
✓ Branch 0 taken 147 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 147 times.
✗ Branch 3 not taken.
147 $$= NEW_PTN Item_func_bit_xor(@$, $1, $3);
10557 }
10558 | simple_expr %prec SET_VAR
10559 ;
10560
10561 or:
10562 OR_SYM
10563 | OR2_SYM
10564 ;
10565
10566 and:
10567 AND_SYM
10568 | AND_AND_SYM
10569 {
10570
1/2
✓ Branch 0 taken 1072 times.
✗ Branch 1 not taken.
1072 push_deprecated_warn(YYTHD, "&&", "AND");
10571 }
10572 ;
10573
10574 not:
10575 NOT_SYM
10576 | NOT2_SYM
10577 ;
10578
10579 not2:
10580
1/2
✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
44 '!' { push_deprecated_warn(YYTHD, "!", "NOT"); }
10581 | NOT2_SYM
10582 ;
10583
10584 comp_op:
10585 10678271 EQ { $$ = &comp_eq_creator; }
10586 2968 | EQUAL_SYM { $$ = &comp_equal_creator; }
10587 71606 | GE { $$ = &comp_ge_creator; }
10588 207433 | GT_SYM { $$ = &comp_gt_creator; }
10589 499527 | LE { $$ = &comp_le_creator; }
10590 61586 | LT { $$ = &comp_lt_creator; }
10591 2153341 | NE { $$ = &comp_ne_creator; }
10592 ;
10593
10594 all_or_any:
10595 129 ALL { $$ = 1; }
10596 215 | ANY_SYM { $$ = 0; }
10597 ;
10598
10599 simple_expr:
10600 simple_ident
10601 | function_call_keyword
10602 | function_call_nonkeyword
10603 | function_call_generic
10604 | function_call_conflict
10605 | simple_expr COLLATE_SYM ident_or_text %prec NEG
10606 {
10607
2/4
✓ Branch 0 taken 124383 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 124383 times.
✗ Branch 3 not taken.
124383 $$= NEW_PTN Item_func_set_collation(@$, $1, $3);
10608 }
10609 | literal_or_null
10610 275168 | param_marker { $$= $1; }
10611 | rvalue_system_or_user_variable
10612 | in_expression_user_variable_assignment
10613 | set_function_specification
10614 | window_func_call
10615 | simple_expr OR_OR_SYM simple_expr
10616 {
10617
2/4
✓ Branch 0 taken 218 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 218 times.
✗ Branch 3 not taken.
218 $$= NEW_PTN Item_func_concat(@$, $1, $3);
10618 }
10619 | '+' simple_expr %prec NEG
10620 {
10621 2219 $$= $2; // TODO: do we really want to ignore unary '+' before any kind of literals?
10622 }
10623 | '-' simple_expr %prec NEG
10624 {
10625
2/4
✓ Branch 0 taken 208212 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 208212 times.
✗ Branch 3 not taken.
208212 $$= NEW_PTN Item_func_neg(@$, $2);
10626 }
10627 | '~' simple_expr %prec NEG
10628 {
10629
2/4
✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 53 times.
✗ Branch 3 not taken.
53 $$= NEW_PTN Item_func_bit_neg(@$, $2);
10630 }
10631 | not2 simple_expr %prec NEG
10632 {
10633
2/4
✓ Branch 0 taken 55 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 55 times.
✗ Branch 3 not taken.
55 $$= NEW_PTN PTI_truth_transform(@$, $2, Item::BOOL_NEGATED);
10634 }
10635 | row_subquery
10636 {
10637
2/4
✓ Branch 0 taken 209740 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 209740 times.
✗ Branch 3 not taken.
209740 $$= NEW_PTN PTI_singlerow_subselect(@$, $1);
10638 }
10639 14463339 | '(' expr ')' { $$= $2; }
10640 | '(' expr ',' expr_list ')'
10641 {
10642
2/4
✓ Branch 0 taken 1432 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1432 times.
✗ Branch 3 not taken.
1432 $$= NEW_PTN Item_row(@$, $2, $4->value);
10643 }
10644 | ROW_SYM '(' expr ',' expr_list ')'
10645 {
10646
2/4
✓ Branch 0 taken 337 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 337 times.
✗ Branch 3 not taken.
337 $$= NEW_PTN Item_row(@$, $3, $5->value);
10647 }
10648 | EXISTS table_subquery
10649 {
10650
2/4
✓ Branch 0 taken 2947 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2947 times.
✗ Branch 3 not taken.
2947 $$= NEW_PTN PTI_exists_subselect(@$, $2);
10651 }
10652 | '{' ident expr '}'
10653 {
10654
2/4
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
✗ Branch 3 not taken.
25 $$= NEW_PTN PTI_odbc_date(@$, $2, $3);
10655 }
10656 | MATCH ident_list_arg AGAINST '(' bit_expr fulltext_options ')'
10657 {
10658
2/4
✓ Branch 0 taken 2797 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2797 times.
✗ Branch 3 not taken.
2797 $$= NEW_PTN Item_func_match(@$, $2, $5, $6);
10659 }
10660 | BINARY_SYM simple_expr %prec NEG
10661 {
10662
1/2
✓ Branch 0 taken 815 times.
✗ Branch 1 not taken.
815 push_deprecated_warn(YYTHD, "BINARY expr", "CAST");
10663
1/2
✓ Branch 0 taken 815 times.
✗ Branch 1 not taken.
815 $$= create_func_cast(YYTHD, @2, $2, ITEM_CAST_CHAR, &my_charset_bin);
10664 }
10665 | CAST_SYM '(' expr AS cast_type opt_array_cast ')'
10666 {
10667
1/2
✓ Branch 0 taken 1183003 times.
✗ Branch 1 not taken.
1183003 $$= create_func_cast(YYTHD, @3, $3, $5, $6);
10668 }
10669 | CAST_SYM '(' expr AT_SYM LOCAL_SYM AS cast_type opt_array_cast ')'
10670 {
10671
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 my_error(ER_NOT_SUPPORTED_YET, MYF(0), "AT LOCAL");
10672 }
10673 | CAST_SYM '(' expr AT_SYM TIME_SYM ZONE_SYM opt_interval
10674 TEXT_STRING_literal AS DATETIME_SYM type_datetime_precision ')'
10675 {
10676 6 Cast_type cast_type{ITEM_CAST_DATETIME, nullptr, nullptr, $11};
10677 auto datetime_factor =
10678
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
6 NEW_PTN Item_func_at_time_zone(@3, $3, $8.str, $7);
10679
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 $$ = create_func_cast(YYTHD, @3, datetime_factor, cast_type, false);
10680 }
10681 | CASE_SYM opt_expr when_list opt_else END
10682 {
10683
2/4
✓ Branch 0 taken 310178 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 310178 times.
✗ Branch 3 not taken.
310178 $$= NEW_PTN Item_func_case(@$, $3, $2, $4 );
10684 }
10685 | CONVERT_SYM '(' expr ',' cast_type ')'
10686 {
10687
1/2
✓ Branch 0 taken 164 times.
✗ Branch 1 not taken.
164 $$= create_func_cast(YYTHD, @3, $3, $5, false);
10688 }
10689 | CONVERT_SYM '(' expr USING charset_name ')'
10690 {
10691
2/4
✓ Branch 0 taken 98684 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 98684 times.
✗ Branch 3 not taken.
98684 $$= NEW_PTN Item_func_conv_charset(@$, $3,$5);
10692 }
10693 | DEFAULT_SYM '(' simple_ident ')'
10694 {
10695
2/4
✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 59 times.
✗ Branch 3 not taken.
59 $$= NEW_PTN Item_default_value(@$, $3);
10696 }
10697 | VALUES '(' simple_ident_nospvar ')'
10698 {
10699
2/4
✓ Branch 0 taken 67 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 67 times.
✗ Branch 3 not taken.
67 $$= NEW_PTN Item_insert_value(@$, $3);
10700 }
10701 | INTERVAL_SYM expr interval '+' expr %prec INTERVAL_SYM
10702 /* we cannot put interval before - */
10703 {
10704
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 $$= NEW_PTN Item_date_add_interval(@$, $5, $2, $3, 0);
10705 }
10706 | simple_ident JSON_SEPARATOR_SYM TEXT_STRING_literal
10707 {
10708 Item_string *path=
10709 894 NEW_PTN Item_string(@$, $3.str, $3.length,
10710
2/4
✓ Branch 0 taken 894 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 894 times.
✗ Branch 3 not taken.
894 YYTHD->variables.collation_connection);
10711
2/4
✓ Branch 0 taken 894 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 894 times.
✗ Branch 3 not taken.
894 $$= NEW_PTN Item_func_json_extract(YYTHD, @$, $1, path);
10712 }
10713 | simple_ident JSON_UNQUOTED_SEPARATOR_SYM TEXT_STRING_literal
10714 {
10715 Item_string *path=
10716 543 NEW_PTN Item_string(@$, $3.str, $3.length,
10717
2/4
✓ Branch 0 taken 543 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 543 times.
✗ Branch 3 not taken.
543 YYTHD->variables.collation_connection);
10718
2/4
✓ Branch 0 taken 543 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 543 times.
✗ Branch 3 not taken.
543 Item *extr= NEW_PTN Item_func_json_extract(YYTHD, @$, $1, path);
10719
2/4
✓ Branch 0 taken 543 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 543 times.
✗ Branch 3 not taken.
543 $$= NEW_PTN Item_func_json_unquote(@$, extr);
10720 }
10721 ;
10722
10723 opt_array_cast:
10724 1181677 /* empty */ { $$= false; }
10725 1333 | ARRAY_SYM { $$= true; }
10726 ;
10727
10728 /*
10729 Function call syntax using official SQL 2003 keywords.
10730 Because the function name is an official token,
10731 a dedicated grammar rule is needed in the parser.
10732 There is no potential for conflicts
10733 */
10734 function_call_keyword:
10735 CHAR_SYM '(' expr_list ')'
10736 {
10737
2/4
✓ Branch 0 taken 65577 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 65577 times.
✗ Branch 3 not taken.
65577 $$= NEW_PTN Item_func_char(@$, $3);
10738 }
10739 | CHAR_SYM '(' expr_list USING charset_name ')'
10740 {
10741
2/4
✓ Branch 0 taken 106 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 106 times.
✗ Branch 3 not taken.
106 $$= NEW_PTN Item_func_char(@$, $3, $5);
10742 }
10743 | CURRENT_USER optional_braces
10744 {
10745
2/4
✓ Branch 0 taken 2827 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2827 times.
✗ Branch 3 not taken.
2827 $$= NEW_PTN Item_func_current_user(@$);
10746 }
10747 | DATE_SYM '(' expr ')'
10748 {
10749
2/4
✓ Branch 0 taken 452 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 452 times.
✗ Branch 3 not taken.
452 $$= NEW_PTN Item_typecast_date(@$, $3);
10750 }
10751 | DAY_SYM '(' expr ')'
10752 {
10753
2/4
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
✗ Branch 3 not taken.
52 $$= NEW_PTN Item_func_dayofmonth(@$, $3);
10754 }
10755 | HOUR_SYM '(' expr ')'
10756 {
10757
2/4
✓ Branch 0 taken 150 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 150 times.
✗ Branch 3 not taken.
150 $$= NEW_PTN Item_func_hour(@$, $3);
10758 }
10759 | INSERT_SYM '(' expr ',' expr ',' expr ',' expr ')'
10760 {
10761
2/4
✓ Branch 0 taken 7080 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7080 times.
✗ Branch 3 not taken.
7080 $$= NEW_PTN Item_func_insert(@$, $3, $5, $7, $9);
10762 }
10763 | INTERVAL_SYM '(' expr ',' expr ')' %prec INTERVAL_SYM
10764 {
10765
2/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
5 $$= NEW_PTN Item_func_interval(@$, YYMEM_ROOT, $3, $5);
10766 }
10767 | INTERVAL_SYM '(' expr ',' expr ',' expr_list ')' %prec INTERVAL_SYM
10768 {
10769
2/4
✓ Branch 0 taken 43 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 43 times.
✗ Branch 3 not taken.
43 $$= NEW_PTN Item_func_interval(@$, YYMEM_ROOT, $3, $5, $7);
10770 }
10771 | JSON_VALUE_SYM '(' simple_expr ',' text_literal
10772 opt_returning_type opt_on_empty_or_error ')'
10773 {
10774 10 $$= create_func_json_value(YYTHD, @3, $3, $5, $6,
10775 10 $7.empty.type, $7.empty.default_string,
10776
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 $7.error.type, $7.error.default_string);
10777 }
10778 | LEFT '(' expr ',' expr ')'
10779 {
10780
2/4
✓ Branch 0 taken 151287 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 151287 times.
✗ Branch 3 not taken.
151287 $$= NEW_PTN Item_func_left(@$, $3, $5);
10781 }
10782 | MINUTE_SYM '(' expr ')'
10783 {
10784
2/4
✓ Branch 0 taken 121 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 121 times.
✗ Branch 3 not taken.
121 $$= NEW_PTN Item_func_minute(@$, $3);
10785 }
10786 | MONTH_SYM '(' expr ')'
10787 {
10788
2/4
✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 282 times.
✗ Branch 3 not taken.
282 $$= NEW_PTN Item_func_month(@$, $3);
10789 }
10790 | RIGHT '(' expr ',' expr ')'
10791 {
10792
2/4
✓ Branch 0 taken 15265 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15265 times.
✗ Branch 3 not taken.
15265 $$= NEW_PTN Item_func_right(@$, $3, $5);
10793 }
10794 | SECOND_SYM '(' expr ')'
10795 {
10796
2/4
✓ Branch 0 taken 131 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 131 times.
✗ Branch 3 not taken.
131 $$= NEW_PTN Item_func_second(@$, $3);
10797 }
10798 | TIME_SYM '(' expr ')'
10799 {
10800
2/4
✓ Branch 0 taken 139 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 139 times.
✗ Branch 3 not taken.
139 $$= NEW_PTN Item_typecast_time(@$, $3);
10801 }
10802 | TIMESTAMP_SYM '(' expr ')'
10803 {
10804
2/4
✓ Branch 0 taken 103 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 103 times.
✗ Branch 3 not taken.
103 $$= NEW_PTN Item_typecast_datetime(@$, $3);
10805 }
10806 | TIMESTAMP_SYM '(' expr ',' expr ')'
10807 {
10808
2/4
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
✗ Branch 3 not taken.
37 $$= NEW_PTN Item_func_add_time(@$, $3, $5, 1, 0);
10809 }
10810 | TRIM '(' expr ')'
10811 {
10812
1/2
✓ Branch 0 taken 81914 times.
✗ Branch 1 not taken.
163828 $$= NEW_PTN Item_func_trim(@$, $3,
10813
1/2
✓ Branch 0 taken 81914 times.
✗ Branch 1 not taken.
163828 Item_func_trim::TRIM_BOTH_DEFAULT);
10814 }
10815 | TRIM '(' LEADING expr FROM expr ')'
10816 {
10817
1/2
✓ Branch 0 taken 55 times.
✗ Branch 1 not taken.
110 $$= NEW_PTN Item_func_trim(@$, $6, $4,
10818
1/2
✓ Branch 0 taken 55 times.
✗ Branch 1 not taken.
110 Item_func_trim::TRIM_LEADING);
10819 }
10820 | TRIM '(' TRAILING expr FROM expr ')'
10821 {
10822
1/2
✓ Branch 0 taken 2327 times.
✗ Branch 1 not taken.
4654 $$= NEW_PTN Item_func_trim(@$, $6, $4,
10823
1/2
✓ Branch 0 taken 2327 times.
✗ Branch 1 not taken.
4654 Item_func_trim::TRIM_TRAILING);
10824 }
10825 | TRIM '(' BOTH expr FROM expr ')'
10826 {
10827
2/4
✓ Branch 0 taken 1223 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1223 times.
✗ Branch 3 not taken.
1223 $$= NEW_PTN Item_func_trim(@$, $6, $4, Item_func_trim::TRIM_BOTH);
10828 }
10829 | TRIM '(' LEADING FROM expr ')'
10830 {
10831
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 $$= NEW_PTN Item_func_trim(@$, $5, Item_func_trim::TRIM_LEADING);
10832 }
10833 | TRIM '(' TRAILING FROM expr ')'
10834 {
10835
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 $$= NEW_PTN Item_func_trim(@$, $5, Item_func_trim::TRIM_TRAILING);
10836 }
10837 | TRIM '(' BOTH FROM expr ')'
10838 {
10839
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 $$= NEW_PTN Item_func_trim(@$, $5, Item_func_trim::TRIM_BOTH);
10840 }
10841 | TRIM '(' expr FROM expr ')'
10842 {
10843
1/2
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
30 $$= NEW_PTN Item_func_trim(@$, $5, $3,
10844
1/2
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
30 Item_func_trim::TRIM_BOTH_DEFAULT);
10845 }
10846 | USER '(' ')'
10847 {
10848
2/4
✓ Branch 0 taken 5052 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5052 times.
✗ Branch 3 not taken.
5052 $$= NEW_PTN Item_func_user(@$);
10849 }
10850 | YEAR_SYM '(' expr ')'
10851 {
10852
2/4
✓ Branch 0 taken 1311 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1311 times.
✗ Branch 3 not taken.
1311 $$= NEW_PTN Item_func_year(@$, $3);
10853 }
10854 ;
10855
10856 /*
10857 Function calls using non reserved keywords, with special syntaxic forms.
10858 Dedicated grammar rules are needed because of the syntax,
10859 but also have the potential to cause incompatibilities with other
10860 parts of the language.
10861 MAINTAINER:
10862 The only reasons a function should be added here are:
10863 - for compatibility reasons with another SQL syntax (CURDATE),
10864 - for typing reasons (GET_FORMAT)
10865 Any other 'Syntaxic sugar' enhancements should be *STRONGLY*
10866 discouraged.
10867 */
10868 function_call_nonkeyword:
10869 ADDDATE_SYM '(' expr ',' expr ')'
10870 {
10871
2/4
✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 27 times.
✗ Branch 3 not taken.
27 $$= NEW_PTN Item_date_add_interval(@$, $3, $5, INTERVAL_DAY, 0);
10872 }
10873 | ADDDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
10874 {
10875
2/4
✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 91 times.
✗ Branch 3 not taken.
91 $$= NEW_PTN Item_date_add_interval(@$, $3, $6, $7, 0);
10876 }
10877 | CURDATE optional_braces
10878 {
10879
2/4
✓ Branch 0 taken 242 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 242 times.
✗ Branch 3 not taken.
242 $$= NEW_PTN Item_func_curdate_local(@$);
10880 }
10881 | CURTIME func_datetime_precision
10882 {
10883
2/4
✓ Branch 0 taken 263 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 263 times.
✗ Branch 3 not taken.
263 $$= NEW_PTN Item_func_curtime_local(@$, static_cast<uint8>($2));
10884 }
10885 | DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'
10886 %prec INTERVAL_SYM
10887 {
10888
2/4
✓ Branch 0 taken 222 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 222 times.
✗ Branch 3 not taken.
222 $$= NEW_PTN Item_date_add_interval(@$, $3, $6, $7, 0);
10889 }
10890 | DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'
10891 %prec INTERVAL_SYM
10892 {
10893
2/4
✓ Branch 0 taken 152 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 152 times.
✗ Branch 3 not taken.
152 $$= NEW_PTN Item_date_add_interval(@$, $3, $6, $7, 1);
10894 }
10895 | EXTRACT_SYM '(' interval FROM expr ')'
10896 {
10897
2/4
✓ Branch 0 taken 411 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 411 times.
✗ Branch 3 not taken.
411 $$= NEW_PTN Item_extract(@$, $3, $5);
10898 }
10899 | GET_FORMAT '(' date_time_type ',' expr ')'
10900 {
10901
2/4
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
✗ Branch 3 not taken.
28 $$= NEW_PTN Item_func_get_format(@$, $3, $5);
10902 }
10903 | now
10904 {
10905
1/2
✓ Branch 0 taken 100726 times.
✗ Branch 1 not taken.
201454 $$= NEW_PTN PTI_function_call_nonkeyword_now(@$,
10906
1/2
✓ Branch 0 taken 100728 times.
✗ Branch 1 not taken.
201449 static_cast<uint8>($1));
10907 }
10908 | POSITION_SYM '(' bit_expr IN_SYM expr ')'
10909 {
10910
2/4
✓ Branch 0 taken 46 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 46 times.
✗ Branch 3 not taken.
46 $$= NEW_PTN Item_func_locate(@$, $5,$3);
10911 }
10912 | SUBDATE_SYM '(' expr ',' expr ')'
10913 {
10914
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 $$= NEW_PTN Item_date_add_interval(@$, $3, $5, INTERVAL_DAY, 1);
10915 }
10916 | SUBDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
10917 {
10918
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
6 $$= NEW_PTN Item_date_add_interval(@$, $3, $6, $7, 1);
10919 }
10920 | SUBSTRING '(' expr ',' expr ',' expr ')'
10921 {
10922
2/4
✓ Branch 0 taken 2438224 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2438224 times.
✗ Branch 3 not taken.
2438224 $$= NEW_PTN Item_func_substr(@$, $3,$5,$7);
10923 }
10924 | SUBSTRING '(' expr ',' expr ')'
10925 {
10926
2/4
✓ Branch 0 taken 2810062 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2810062 times.
✗ Branch 3 not taken.
2810062 $$= NEW_PTN Item_func_substr(@$, $3,$5);
10927 }
10928 | SUBSTRING '(' expr FROM expr FOR_SYM expr ')'
10929 {
10930
2/4
✓ Branch 0 taken 264 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 264 times.
✗ Branch 3 not taken.
264 $$= NEW_PTN Item_func_substr(@$, $3,$5,$7);
10931 }
10932 | SUBSTRING '(' expr FROM expr ')'
10933 {
10934
2/4
✓ Branch 0 taken 201 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 201 times.
✗ Branch 3 not taken.
201 $$= NEW_PTN Item_func_substr(@$, $3,$5);
10935 }
10936 | SYSDATE func_datetime_precision
10937 {
10938
1/2
✓ Branch 0 taken 141 times.
✗ Branch 1 not taken.
282 $$= NEW_PTN PTI_function_call_nonkeyword_sysdate(@$,
10939
1/2
✓ Branch 0 taken 141 times.
✗ Branch 1 not taken.
282 static_cast<uint8>($2));
10940 }
10941 | TIMESTAMP_ADD '(' interval_time_stamp ',' expr ',' expr ')'
10942 {
10943
2/4
✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 53 times.
✗ Branch 3 not taken.
53 $$= NEW_PTN Item_date_add_interval(@$, $7, $5, $3, 0);
10944 }
10945 | TIMESTAMP_DIFF '(' interval_time_stamp ',' expr ',' expr ')'
10946 {
10947
2/4
✓ Branch 0 taken 12006 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12006 times.
✗ Branch 3 not taken.
12006 $$= NEW_PTN Item_func_timestamp_diff(@$, $5,$7,$3);
10948 }
10949 | UTC_DATE_SYM optional_braces
10950 {
10951
2/4
✓ Branch 0 taken 43 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 43 times.
✗ Branch 3 not taken.
43 $$= NEW_PTN Item_func_curdate_utc(@$);
10952 }
10953 | UTC_TIME_SYM func_datetime_precision
10954 {
10955
2/4
✓ Branch 0 taken 45 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 45 times.
✗ Branch 3 not taken.
45 $$= NEW_PTN Item_func_curtime_utc(@$, static_cast<uint8>($2));
10956 }
10957 | UTC_TIMESTAMP_SYM func_datetime_precision
10958 {
10959
2/4
✓ Branch 0 taken 1225 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1225 times.
✗ Branch 3 not taken.
1225 $$= NEW_PTN Item_func_now_utc(@$, static_cast<uint8>($2));
10960 }
10961 ;
10962
10963 // JSON_VALUE's optional JSON returning clause.
10964 opt_returning_type:
10965 // The default returning type is CHAR(512). (The max length of 512
10966 // is chosen so that the returned values are not handled as BLOBs
10967 // internally. See CONVERT_IF_BIGGER_TO_BLOB.)
10968 {
10969 $$= {ITEM_CAST_CHAR, nullptr, "512", nullptr};
10970 }
10971 | RETURNING_SYM cast_type
10972 {
10973 10 $$= $2;
10974 }
10975 ;
10976 /*
10977 Functions calls using a non reserved keyword, and using a regular syntax.
10978 Because the non reserved keyword is used in another part of the grammar,
10979 a dedicated rule is needed here.
10980 */
10981 function_call_conflict:
10982 ASCII_SYM '(' expr ')'
10983 {
10984
2/4
✓ Branch 0 taken 1264 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1264 times.
✗ Branch 3 not taken.
1264 $$= NEW_PTN Item_func_ascii(@$, $3);
10985 }
10986 | CHARSET '(' expr ')'
10987 {
10988
2/4
✓ Branch 0 taken 406 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 406 times.
✗ Branch 3 not taken.
406 $$= NEW_PTN Item_func_charset(@$, $3);
10989 }
10990 | COALESCE '(' expr_list ')'
10991 {
10992
2/4
✓ Branch 0 taken 1839083 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1839083 times.
✗ Branch 3 not taken.
1839083 $$= NEW_PTN Item_func_coalesce(@$, $3);
10993 }
10994 | COLLATION_SYM '(' expr ')'
10995 {
10996
2/4
✓ Branch 0 taken 1246 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
✗ Branch 3 not taken.
1246 $$= NEW_PTN Item_func_collation(@$, $3);
10997 }
10998 | DATABASE '(' ')'
10999 {
11000
2/4
✓ Branch 0 taken 11269 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11270 times.
✗ Branch 3 not taken.
11269 $$= NEW_PTN Item_func_database(@$);
11001 }
11002 | IF '(' expr ',' expr ',' expr ')'
11003 {
11004
2/4
✓ Branch 0 taken 6248062 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6248062 times.
✗ Branch 3 not taken.
6248062 $$= NEW_PTN Item_func_if(@$, $3,$5,$7);
11005 }
11006 | FORMAT_SYM '(' expr ',' expr ')'
11007 {
11008
2/4
✓ Branch 0 taken 213 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 213 times.
✗ Branch 3 not taken.
213 $$= NEW_PTN Item_func_format(@$, $3, $5);
11009 }
11010 | FORMAT_SYM '(' expr ',' expr ',' expr ')'
11011 {
11012
2/4
✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 61 times.
✗ Branch 3 not taken.
61 $$= NEW_PTN Item_func_format(@$, $3, $5, $7);
11013 }
11014 | MICROSECOND_SYM '(' expr ')'
11015 {
11016
2/4
✓ Branch 0 taken 127 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 127 times.
✗ Branch 3 not taken.
127 $$= NEW_PTN Item_func_microsecond(@$, $3);
11017 }
11018 | MOD_SYM '(' expr ',' expr ')'
11019 {
11020
2/4
✓ Branch 0 taken 9915 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9915 times.
✗ Branch 3 not taken.
9915 $$= NEW_PTN Item_func_mod(@$, $3, $5);
11021 }
11022 | QUARTER_SYM '(' expr ')'
11023 {
11024
2/4
✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
126 $$= NEW_PTN Item_func_quarter(@$, $3);
11025 }
11026 | REPEAT_SYM '(' expr ',' expr ')'
11027 {
11028
2/4
✓ Branch 0 taken 1171410 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1171412 times.
✗ Branch 3 not taken.
1171410 $$= NEW_PTN Item_func_repeat(@$, $3,$5);
11029 }
11030 | REPLACE_SYM '(' expr ',' expr ',' expr ')'
11031 {
11032
2/4
✓ Branch 0 taken 303848 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 303848 times.
✗ Branch 3 not taken.
303848 $$= NEW_PTN Item_func_replace(@$, $3,$5,$7);
11033 }
11034 | REVERSE_SYM '(' expr ')'
11035 {
11036
2/4
✓ Branch 0 taken 3148 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3148 times.
✗ Branch 3 not taken.
3148 $$= NEW_PTN Item_func_reverse(@$, $3);
11037 }
11038 | ROW_COUNT_SYM '(' ')'
11039 {
11040
2/4
✓ Branch 0 taken 4922 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4922 times.
✗ Branch 3 not taken.
4922 $$= NEW_PTN Item_func_row_count(@$);
11041 }
11042 | TRUNCATE_SYM '(' expr ',' expr ')'
11043 {
11044
2/4
✓ Branch 0 taken 101 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 101 times.
✗ Branch 3 not taken.
101 $$= NEW_PTN Item_func_round(@$, $3,$5,1);
11045 }
11046 | WEEK_SYM '(' expr ')'
11047 {
11048
2/4
✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
✗ Branch 3 not taken.
88 $$= NEW_PTN Item_func_week(@$, $3, NULL);
11049 }
11050 | WEEK_SYM '(' expr ',' expr ')'
11051 {
11052
2/4
✓ Branch 0 taken 94 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 94 times.
✗ Branch 3 not taken.
94 $$= NEW_PTN Item_func_week(@$, $3, $5);
11053 }
11054 | WEIGHT_STRING_SYM '(' expr ')'
11055 {
11056
2/4
✓ Branch 0 taken 610 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 610 times.
✗ Branch 3 not taken.
610 $$= NEW_PTN Item_func_weight_string(@$, $3, 0, 0, 0);
11057 }
11058 | WEIGHT_STRING_SYM '(' expr AS CHAR_SYM ws_num_codepoints ')'
11059 {
11060
2/4
✓ Branch 0 taken 568 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 568 times.
✗ Branch 3 not taken.
568 $$= NEW_PTN Item_func_weight_string(@$, $3, 0, $6, 0);
11061 }
11062 | WEIGHT_STRING_SYM '(' expr AS BINARY_SYM ws_num_codepoints ')'
11063 {
11064
2/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
8 $$= NEW_PTN Item_func_weight_string(@$, $3, 0, $6, 0, true);
11065 }
11066 | WEIGHT_STRING_SYM '(' expr ',' ulong_num ',' ulong_num ',' ulong_num ')'
11067 {
11068
2/4
✓ Branch 0 taken 2072 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2072 times.
✗ Branch 3 not taken.
2072 $$= NEW_PTN Item_func_weight_string(@$, $3, $5, $7, $9);
11069 }
11070 | geometry_function
11071 ;
11072
11073 geometry_function:
11074 GEOMETRYCOLLECTION_SYM '(' opt_expr_list ')'
11075 {
11076
1/2
✓ Branch 0 taken 259 times.
✗ Branch 1 not taken.
518 $$= NEW_PTN Item_func_spatial_collection(@$, $3,
11077 Geometry::wkb_geometrycollection,
11078
1/2
✓ Branch 0 taken 259 times.
✗ Branch 1 not taken.
518 Geometry::wkb_point);
11079 }
11080 | LINESTRING_SYM '(' expr_list ')'
11081 {
11082
1/2
✓ Branch 0 taken 1361 times.
✗ Branch 1 not taken.
2722 $$= NEW_PTN Item_func_spatial_collection(@$, $3,
11083 Geometry::wkb_linestring,
11084
1/2
✓ Branch 0 taken 1361 times.
✗ Branch 1 not taken.
2722 Geometry::wkb_point);
11085 }
11086 | MULTILINESTRING_SYM '(' expr_list ')'
11087 {
11088
1/2
✓ Branch 0 taken 112 times.
✗ Branch 1 not taken.
224 $$= NEW_PTN Item_func_spatial_collection(@$, $3,
11089 Geometry::wkb_multilinestring,
11090
1/2
✓ Branch 0 taken 112 times.
✗ Branch 1 not taken.
224 Geometry::wkb_linestring);
11091 }
11092 | MULTIPOINT_SYM '(' expr_list ')'
11093 {
11094
1/2
✓ Branch 0 taken 109 times.
✗ Branch 1 not taken.
218 $$= NEW_PTN Item_func_spatial_collection(@$, $3,
11095 Geometry::wkb_multipoint,
11096
1/2
✓ Branch 0 taken 109 times.
✗ Branch 1 not taken.
218 Geometry::wkb_point);
11097 }
11098 | MULTIPOLYGON_SYM '(' expr_list ')'
11099 {
11100
1/2
✓ Branch 0 taken 136 times.
✗ Branch 1 not taken.
272 $$= NEW_PTN Item_func_spatial_collection(@$, $3,
11101 Geometry::wkb_multipolygon,
11102
1/2
✓ Branch 0 taken 136 times.
✗ Branch 1 not taken.
272 Geometry::wkb_polygon);
11103 }
11104 | POINT_SYM '(' expr ',' expr ')'
11105 {
11106
2/4
✓ Branch 0 taken 6106 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6106 times.
✗ Branch 3 not taken.
6106 $$= NEW_PTN Item_func_point(@$, $3,$5);
11107 }
11108 | POLYGON_SYM '(' expr_list ')'
11109 {
11110
1/2
✓ Branch 0 taken 445 times.
✗ Branch 1 not taken.
890 $$= NEW_PTN Item_func_spatial_collection(@$, $3,
11111 Geometry::wkb_polygon,
11112
1/2
✓ Branch 0 taken 445 times.
✗ Branch 1 not taken.
890 Geometry::wkb_linestring);
11113 }
11114 ;
11115
11116 /*
11117 Regular function calls.
11118 The function name is *not* a token, and therefore is guaranteed to not
11119 introduce side effects to the language in general.
11120 MAINTAINER:
11121 All the new functions implemented for new features should fit into
11122 this category. The place to implement the function itself is
11123 in sql/item_create.cc
11124 */
11125 function_call_generic:
11126 IDENT_sys '(' opt_udf_expr_list ')'
11127 {
11128
2/4
✓ Branch 0 taken 8371043 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8371045 times.
✗ Branch 3 not taken.
8371042 $$= NEW_PTN PTI_function_call_generic_ident_sys(@1, $1, $3);
11129 }
11130 | ident '.' ident '(' opt_expr_list ')'
11131 {
11132
2/4
✓ Branch 0 taken 140822 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 140822 times.
✗ Branch 3 not taken.
140822 $$= NEW_PTN PTI_function_call_generic_2d(@$, $1, $3, $5);
11133 }
11134 ;
11135
11136 fulltext_options:
11137 opt_natural_language_mode opt_query_expansion
11138 1317 { $$= $1 | $2; }
11139 | IN_SYM BOOLEAN_SYM MODE_SYM
11140 {
11141 1482 $$= FT_BOOL;
11142
6/8
✓ Branch 0 taken 1482 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 1479 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
1482 DBUG_EXECUTE_IF("simulate_bug18831513",
11143 {
11144 THD *thd= YYTHD;
11145 if (thd->sp_runtime_ctx)
11146 YYTHD->syntax_error();
11147 });
11148 }
11149 ;
11150
11151 opt_natural_language_mode:
11152 1143 /* nothing */ { $$= FT_NL; }
11153 174 | IN_SYM NATURAL LANGUAGE_SYM MODE_SYM { $$= FT_NL; }
11154 ;
11155
11156 opt_query_expansion:
11157 1186 /* nothing */ { $$= 0; }
11158 131 | WITH QUERY_SYM EXPANSION_SYM { $$= FT_EXPAND; }
11159 ;
11160
11161 opt_udf_expr_list:
11162 255700 /* empty */ { $$= NULL; }
11163 8115509 | udf_expr_list { $$= $1; }
11164 ;
11165
11166 udf_expr_list:
11167 udf_expr
11168 {
11169
2/4
✓ Branch 0 taken 8115540 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8115540 times.
✗ Branch 3 not taken.
8115541 $$= NEW_PTN PT_item_list;
11170
4/8
✓ Branch 0 taken 8115541 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8115540 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8115540 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 8115539 times.
8115540 if ($$ == NULL || $$->push_back($1))
11171 MYSQL_YYABORT;
11172 }
11173 | udf_expr_list ',' udf_expr
11174 {
11175
4/8
✓ Branch 0 taken 17363577 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17363575 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 17363575 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 17363575 times.
17363577 if ($1 == NULL || $1->push_back($3))
11176 MYSQL_YYABORT;
11177 17363575 $$= $1;
11178 }
11179 ;
11180
11181 udf_expr:
11182 expr select_alias
11183 {
11184
2/4
✓ Branch 0 taken 25479113 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25479116 times.
✗ Branch 3 not taken.
25479117 $$= NEW_PTN PTI_udf_expr(@$, $1, $2, @1.cpp);
11185 }
11186 ;
11187
11188 set_function_specification:
11189 sum_expr
11190 | grouping_operation
11191 ;
11192
11193 sum_expr:
11194 AVG_SYM '(' in_sum_expr ')' opt_windowing_clause
11195 {
11196
2/4
✓ Branch 0 taken 3253 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3253 times.
✗ Branch 3 not taken.
3253 $$= NEW_PTN Item_sum_avg(@$, $3, false, $5);
11197 }
11198 | AVG_SYM '(' DISTINCT in_sum_expr ')' opt_windowing_clause
11199 {
11200
2/4
✓ Branch 0 taken 93 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 93 times.
✗ Branch 3 not taken.
93 $$= NEW_PTN Item_sum_avg(@$, $4, true, $6);
11201 }
11202 | BIT_AND_SYM '(' in_sum_expr ')' opt_windowing_clause
11203 {
11204
2/4
✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 54 times.
✗ Branch 3 not taken.
54 $$= NEW_PTN Item_sum_and(@$, $3, $5);
11205 }
11206 | BIT_OR_SYM '(' in_sum_expr ')' opt_windowing_clause
11207 {
11208
2/4
✓ Branch 0 taken 39 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
✗ Branch 3 not taken.
39 $$= NEW_PTN Item_sum_or(@$, $3, $5);
11209 }
11210 | JSON_ARRAYAGG '(' in_sum_expr ')' opt_windowing_clause
11211 {
11212 94 auto wrapper = make_unique_destroy_only<Json_wrapper>(YYMEM_ROOT);
11213
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 94 times.
94 if (wrapper == nullptr) YYABORT;
11214 unique_ptr_destroy_only<Json_array> array{::new (YYMEM_ROOT)
11215
2/4
✓ Branch 0 taken 94 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 94 times.
✗ Branch 3 not taken.
94 Json_array};
11216
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 94 times.
94 if (array == nullptr) YYABORT;
11217
1/2
✓ Branch 0 taken 94 times.
✗ Branch 1 not taken.
376 $$ = NEW_PTN Item_sum_json_array(@$, $3, $5, std::move(wrapper),
11218
1/2
✓ Branch 0 taken 94 times.
✗ Branch 1 not taken.
282 std::move(array));
11219
2/4
✓ Branch 0 taken 94 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 94 times.
✗ Branch 3 not taken.
94 }
11220 | JSON_OBJECTAGG '(' in_sum_expr ',' in_sum_expr ')' opt_windowing_clause
11221 {
11222 114 auto wrapper = make_unique_destroy_only<Json_wrapper>(YYMEM_ROOT);
11223
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 114 times.
114 if (wrapper == nullptr) YYABORT;
11224 unique_ptr_destroy_only<Json_object> object{::new (YYMEM_ROOT)
11225
2/4
✓ Branch 0 taken 114 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 114 times.
✗ Branch 3 not taken.
114 Json_object};
11226
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 114 times.
114 if (object == nullptr) YYABORT;
11227
1/2
✓ Branch 0 taken 114 times.
✗ Branch 1 not taken.
456 $$ = NEW_PTN Item_sum_json_object(
11228
1/2
✓ Branch 0 taken 114 times.
✗ Branch 1 not taken.
456 @$, $3, $5, $7, std::move(wrapper), std::move(object));
11229
2/4
✓ Branch 0 taken 114 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 114 times.
✗ Branch 3 not taken.
114 }
11230 | ST_COLLECT_SYM '(' in_sum_expr ')' opt_windowing_clause
11231 {
11232
2/4
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
✗ Branch 3 not taken.
17 $$= NEW_PTN Item_sum_collect(@$, $3, $5, false);
11233 }
11234 | ST_COLLECT_SYM '(' DISTINCT in_sum_expr ')' opt_windowing_clause
11235 {
11236
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
6 $$= NEW_PTN Item_sum_collect(@$, $4, $6, true );
11237 }
11238 | BIT_XOR_SYM '(' in_sum_expr ')' opt_windowing_clause
11239 {
11240
2/4
✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35 times.
✗ Branch 3 not taken.
35 $$= NEW_PTN Item_sum_xor(@$, $3, $5);
11241 }
11242 | COUNT_SYM '(' opt_all '*' ')' opt_windowing_clause
11243 {
11244
2/4
✓ Branch 0 taken 283344 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 283344 times.
✗ Branch 3 not taken.
283344 $$= NEW_PTN PTI_count_sym(@$, $6);
11245 }
11246 | COUNT_SYM '(' in_sum_expr ')' opt_windowing_clause
11247 {
11248
2/4
✓ Branch 0 taken 155762 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 155762 times.
✗ Branch 3 not taken.
155762 $$= NEW_PTN Item_sum_count(@$, $3, $5);
11249 }
11250 | COUNT_SYM '(' DISTINCT expr_list ')' opt_windowing_clause
11251 {
11252
2/4
✓ Branch 0 taken 42068 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 42068 times.
✗ Branch 3 not taken.
42068 $$= new Item_sum_count(@$, $4, $6);
11253 }
11254 | MIN_SYM '(' in_sum_expr ')' opt_windowing_clause
11255 {
11256
2/4
✓ Branch 0 taken 10491 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10491 times.
✗ Branch 3 not taken.
10491 $$= NEW_PTN Item_sum_min(@$, $3, $5);
11257 }
11258 /*
11259 According to ANSI SQL, DISTINCT is allowed and has
11260 no sense inside MIN and MAX grouping functions; so MIN|MAX(DISTINCT ...)
11261 is processed like an ordinary MIN | MAX()
11262 */
11263 | MIN_SYM '(' DISTINCT in_sum_expr ')' opt_windowing_clause
11264 {
11265 $$= NEW_PTN Item_sum_min(@$, $4, $6);
11266 }
11267 | MAX_SYM '(' in_sum_expr ')' opt_windowing_clause
11268 {
11269
2/4
✓ Branch 0 taken 35919 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35919 times.
✗ Branch 3 not taken.
35919 $$= NEW_PTN Item_sum_max(@$, $3, $5);
11270 }
11271 | MAX_SYM '(' DISTINCT in_sum_expr ')' opt_windowing_clause
11272 {
11273 $$= NEW_PTN Item_sum_max(@$, $4, $6);
11274 }
11275 | STD_SYM '(' in_sum_expr ')' opt_windowing_clause
11276 {
11277
2/4
✓ Branch 0 taken 311 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 311 times.
✗ Branch 3 not taken.
311 $$= NEW_PTN Item_sum_std(@$, $3, 0, $5);
11278 }
11279 | VARIANCE_SYM '(' in_sum_expr ')' opt_windowing_clause
11280 {
11281
2/4
✓ Branch 0 taken 239 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 239 times.
✗ Branch 3 not taken.
239 $$= NEW_PTN Item_sum_variance(@$, $3, 0, $5);
11282 }
11283 | STDDEV_SAMP_SYM '(' in_sum_expr ')' opt_windowing_clause
11284 {
11285
2/4
✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 34 times.
✗ Branch 3 not taken.
34 $$= NEW_PTN Item_sum_std(@$, $3, 1, $5);
11286 }
11287 | VAR_SAMP_SYM '(' in_sum_expr ')' opt_windowing_clause
11288 {
11289
2/4
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
✗ Branch 3 not taken.
37 $$= NEW_PTN Item_sum_variance(@$, $3, 1, $5);
11290 }
11291 | SUM_SYM '(' in_sum_expr ')' opt_windowing_clause
11292 {
11293
2/4
✓ Branch 0 taken 617250 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 617250 times.
✗ Branch 3 not taken.
617250 $$= NEW_PTN Item_sum_sum(@$, $3, false, $5);
11294 }
11295 | SUM_SYM '(' DISTINCT in_sum_expr ')' opt_windowing_clause
11296 {
11297
2/4
✓ Branch 0 taken 109 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 109 times.
✗ Branch 3 not taken.
109 $$= NEW_PTN Item_sum_sum(@$, $4, true, $6);
11298 }
11299 | GROUP_CONCAT_SYM '(' opt_distinct
11300 expr_list opt_gorder_clause
11301 opt_gconcat_separator
11302 ')' opt_windowing_clause
11303 {
11304
2/4
✓ Branch 0 taken 31742 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 31742 times.
✗ Branch 3 not taken.
31742 $$= NEW_PTN Item_func_group_concat(@$, $3, $4, $5, $6, $8);
11305 }
11306 ;
11307
11308 window_func_call: // Window functions which do not exist as set functions
11309 ROW_NUMBER_SYM '(' ')' windowing_clause
11310 {
11311
2/4
✓ Branch 0 taken 122 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 122 times.
✗ Branch 3 not taken.
122 $$= NEW_PTN Item_row_number(@$, $4);
11312 }
11313 | RANK_SYM '(' ')' windowing_clause
11314 {
11315
2/4
✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
180 $$= NEW_PTN Item_rank(@$, false, $4);
11316 }
11317 | DENSE_RANK_SYM '(' ')' windowing_clause
11318 {
11319
2/4
✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
✗ Branch 3 not taken.
20 $$= NEW_PTN Item_rank(@$, true, $4);
11320 }
11321 | CUME_DIST_SYM '(' ')' windowing_clause
11322 {
11323
2/4
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
✗ Branch 3 not taken.
37 $$= NEW_PTN Item_cume_dist(@$, $4);
11324 }
11325 | PERCENT_RANK_SYM '(' ')' windowing_clause
11326 {
11327
2/4
✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
✗ Branch 3 not taken.
36 $$= NEW_PTN Item_percent_rank(@$, $4);
11328 }
11329 | NTILE_SYM '(' stable_integer ')' windowing_clause
11330 {
11331
2/4
✓ Branch 0 taken 71 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 71 times.
✗ Branch 3 not taken.
71 $$=NEW_PTN Item_ntile(@$, $3, $5);
11332 }
11333 | LEAD_SYM '(' expr opt_lead_lag_info ')' opt_null_treatment windowing_clause
11334 {
11335
2/4
✓ Branch 0 taken 369 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 369 times.
✗ Branch 3 not taken.
369 PT_item_list *args= NEW_PTN PT_item_list;
11336
4/8
✓ Branch 0 taken 369 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 369 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 369 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 369 times.
369 if (args == NULL || args->push_back($3))
11337 MYSQL_YYABORT; // OOM
11338
5/8
✓ Branch 0 taken 359 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 359 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 359 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 369 times.
369 if ($4.offset != NULL && args->push_back($4.offset))
11339 MYSQL_YYABORT; // OOM
11340
5/8
✓ Branch 0 taken 161 times.
✓ Branch 1 taken 208 times.
✓ Branch 2 taken 161 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 161 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 369 times.
369 if ($4.default_value != NULL && args->push_back($4.default_value))
11341 MYSQL_YYABORT; // OOM
11342
2/4
✓ Branch 0 taken 369 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 369 times.
✗ Branch 3 not taken.
369 $$= NEW_PTN Item_lead_lag(@$, true, args, $6, $7);
11343 }
11344 | LAG_SYM '(' expr opt_lead_lag_info ')' opt_null_treatment windowing_clause
11345 {
11346
2/4
✓ Branch 0 taken 203 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 203 times.
✗ Branch 3 not taken.
203 PT_item_list *args= NEW_PTN PT_item_list;
11347
4/8
✓ Branch 0 taken 203 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 203 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 203 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 203 times.
203 if (args == NULL || args->push_back($3))
11348 MYSQL_YYABORT; // OOM
11349
5/8
✓ Branch 0 taken 190 times.
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 190 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 190 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 203 times.
203 if ($4.offset != NULL && args->push_back($4.offset))
11350 MYSQL_YYABORT; // OOM
11351
5/8
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 167 times.
✓ Branch 2 taken 36 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 36 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 203 times.
203 if ($4.default_value != NULL && args->push_back($4.default_value))
11352 MYSQL_YYABORT; // OOM
11353
2/4
✓ Branch 0 taken 203 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 203 times.
✗ Branch 3 not taken.
203 $$= NEW_PTN Item_lead_lag(@$, false, args, $6, $7);
11354 }
11355 | FIRST_VALUE_SYM '(' expr ')' opt_null_treatment windowing_clause
11356 {
11357
2/4
✓ Branch 0 taken 177 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 177 times.
✗ Branch 3 not taken.
177 $$= NEW_PTN Item_first_last_value(@$, true, $3, $5, $6);
11358 }
11359 | LAST_VALUE_SYM '(' expr ')' opt_null_treatment windowing_clause
11360 {
11361
2/4
✓ Branch 0 taken 79 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 79 times.
✗ Branch 3 not taken.
79 $$= NEW_PTN Item_first_last_value(@$, false, $3, $5, $6);
11362 }
11363 | NTH_VALUE_SYM '(' expr ',' simple_expr ')' opt_from_first_last opt_null_treatment windowing_clause
11364 {
11365
2/4
✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 206 times.
✗ Branch 3 not taken.
206 PT_item_list *args= NEW_PTN PT_item_list;
11366 412 if (args == NULL ||
11367
4/8
✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 206 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 206 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 206 times.
412 args->push_back($3) ||
11368
2/4
✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 206 times.
206 args->push_back($5))
11369 MYSQL_YYABORT;
11370
2/4
✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 206 times.
✗ Branch 3 not taken.
206 $$= NEW_PTN Item_nth_value(@$, args, $7 == NFL_FROM_LAST, $8, $9);
11371 }
11372 ;
11373
11374 opt_lead_lag_info:
11375 /* Nothing */
11376 {
11377 23 $$.offset= NULL;
11378 23 $$.default_value= NULL;
11379 }
11380 | ',' stable_integer opt_ll_default
11381 {
11382 549 $$.offset= $2;
11383 549 $$.default_value= $3;
11384 }
11385 ;
11386
11387 /*
11388 The stable_integer nonterminal symbol is not really constant, but constant
11389 for the duration of an execution.
11390 */
11391 stable_integer:
11392 613 int64_literal { $$ = $1; }
11393 | param_or_var
11394 ;
11395
11396 param_or_var:
11397 7 param_marker { $$ = $1; }
11398 | ident { $$ = NEW_PTN PTI_int_splocal(@$, to_lex_cstring($1)); }
11399 | '@' ident_or_text { $$ = NEW_PTN PTI_user_variable(@$, $2); }
11400 ;
11401
11402 opt_ll_default:
11403 /* Nothing */
11404 {
11405 352 $$= NULL;
11406 }
11407 | ',' expr
11408 {
11409 197 $$= $2;
11410 }
11411 ;
11412
11413 opt_null_treatment:
11414 /* Nothing */
11415 {
11416 1006 $$= NT_NONE;
11417 }
11418 | RESPECT_SYM NULLS_SYM
11419 {
11420 26 $$= NT_RESPECT_NULLS;
11421 }
11422 | IGNORE_SYM NULLS_SYM
11423 {
11424 2 $$= NT_IGNORE_NULLS;
11425 }
11426 ;
11427
11428
11429 opt_from_first_last:
11430 /* Nothing */
11431 {
11432 204 $$= NFL_NONE;
11433 }
11434 | FROM FIRST_SYM
11435 {
11436 1 $$= NFL_FROM_FIRST;
11437 }
11438 | FROM LAST_SYM
11439 {
11440 1 $$= NFL_FROM_LAST;
11441 }
11442 ;
11443
11444 opt_windowing_clause:
11445 /* Nothing */
11446 {
11447 1179448 $$= NULL;
11448 }
11449 | windowing_clause
11450 {
11451 1563 $$= $1;
11452 }
11453 ;
11454
11455 windowing_clause:
11456 OVER_SYM window_name_or_spec
11457 {
11458 3063 $$= $2;
11459 }
11460 ;
11461
11462 window_name_or_spec:
11463 window_name
11464 {
11465
2/4
✓ Branch 0 taken 1526 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1526 times.
✗ Branch 3 not taken.
1526 $$= NEW_PTN PT_window($1);
11466 }
11467 | window_spec
11468 {
11469 1537 $$= $1;
11470 }
11471 ;
11472
11473 window_name:
11474 ident
11475 {
11476
2/4
✓ Branch 0 taken 2184 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2184 times.
✗ Branch 3 not taken.
2184 $$= NEW_PTN Item_string($1.str, $1.length, YYTHD->charset());
11477 }
11478 ;
11479
11480 window_spec:
11481 '(' window_spec_details ')'
11482 {
11483 2171 $$= $2;
11484 }
11485 ;
11486
11487 window_spec_details:
11488 opt_existing_window_name
11489 opt_partition_clause
11490 opt_window_order_by_clause
11491 opt_window_frame_clause
11492 {
11493 2171 auto frame= $4;
11494
2/2
✓ Branch 0 taken 1151 times.
✓ Branch 1 taken 1020 times.
2171 if (!frame) // build an equivalent frame spec
11495 {
11496
2/4
✓ Branch 0 taken 1151 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1151 times.
✗ Branch 3 not taken.
1151 auto start_bound= NEW_PTN PT_border(WBT_UNBOUNDED_PRECEDING);
11497 1151 auto end_bound= NEW_PTN PT_border($3 ? WBT_CURRENT_ROW :
11498
4/6
✓ Branch 0 taken 1151 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 450 times.
✓ Branch 3 taken 701 times.
✓ Branch 4 taken 1151 times.
✗ Branch 5 not taken.
1151 WBT_UNBOUNDED_FOLLOWING);
11499
2/4
✓ Branch 0 taken 1151 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1151 times.
✗ Branch 3 not taken.
1151 auto bounds= NEW_PTN PT_borders(start_bound, end_bound);
11500
2/4
✓ Branch 0 taken 1151 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1151 times.
✗ Branch 3 not taken.
1151 frame= NEW_PTN PT_frame(WFU_RANGE, bounds, nullptr);
11501 1151 frame->m_originally_absent= true;
11502 }
11503
2/4
✓ Branch 0 taken 2171 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2171 times.
✗ Branch 3 not taken.
2171 $$= NEW_PTN PT_window($2, $3, frame, $1);
11504 }
11505 ;
11506
11507 opt_existing_window_name:
11508 /* Nothing */
11509 {
11510 2147 $$= NULL;
11511 }
11512 | window_name
11513 {
11514 24 $$= $1;
11515 }
11516 ;
11517
11518 opt_partition_clause:
11519 /* Nothing */
11520 {
11521 1687 $$= NULL;
11522 }
11523 | PARTITION_SYM BY group_list
11524 {
11525 484 $$= $3;
11526 }
11527 ;
11528
11529 opt_window_order_by_clause:
11530 /* Nothing */
11531 {
11532 919 $$= NULL;
11533 }
11534 | ORDER_SYM BY order_list
11535 {
11536 1252 $$= $3;
11537 }
11538 ;
11539
11540 opt_window_frame_clause:
11541 /* Nothing*/
11542 {
11543 1151 $$= NULL;
11544 }
11545 | window_frame_units
11546 window_frame_extent
11547 opt_window_frame_exclusion
11548 {
11549
2/4
✓ Branch 0 taken 1020 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1020 times.
✗ Branch 3 not taken.
1020 $$= NEW_PTN PT_frame($1, $2, $3);
11550 }
11551 ;
11552
11553 window_frame_extent:
11554 window_frame_start
11555 {
11556
2/4
✓ Branch 0 taken 463 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 463 times.
✗ Branch 3 not taken.
463 auto end_bound= NEW_PTN PT_border(WBT_CURRENT_ROW);
11557
2/4
✓ Branch 0 taken 463 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 463 times.
✗ Branch 3 not taken.
463 $$= NEW_PTN PT_borders($1, end_bound);
11558 }
11559 | window_frame_between
11560 {
11561 557 $$= $1;
11562 }
11563 ;
11564
11565 window_frame_start:
11566 UNBOUNDED_SYM PRECEDING_SYM
11567 {
11568
2/4
✓ Branch 0 taken 436 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 436 times.
✗ Branch 3 not taken.
436 $$= NEW_PTN PT_border(WBT_UNBOUNDED_PRECEDING);
11569 }
11570 | NUM_literal PRECEDING_SYM
11571 {
11572
2/4
✓ Branch 0 taken 401 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 401 times.
✗ Branch 3 not taken.
401 $$= NEW_PTN PT_border(WBT_VALUE_PRECEDING, $1);
11573 }
11574 | param_marker PRECEDING_SYM
11575 {
11576
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 $$= NEW_PTN PT_border(WBT_VALUE_PRECEDING, $1);
11577 }
11578 | INTERVAL_SYM expr interval PRECEDING_SYM
11579 {
11580
2/4
✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
✗ Branch 3 not taken.
38 $$= NEW_PTN PT_border(WBT_VALUE_PRECEDING, $2, $3);
11581 }
11582 | CURRENT_SYM ROW_SYM
11583 {
11584
2/4
✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
196 $$= NEW_PTN PT_border(WBT_CURRENT_ROW);
11585 }
11586 ;
11587
11588 window_frame_between:
11589 BETWEEN_SYM window_frame_bound AND_SYM window_frame_bound
11590 {
11591
2/4
✓ Branch 0 taken 557 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 557 times.
✗ Branch 3 not taken.
557 $$= NEW_PTN PT_borders($2, $4);
11592 }
11593 ;
11594
11595 window_frame_bound:
11596 window_frame_start
11597 {
11598 609 $$= $1;
11599 }
11600 | UNBOUNDED_SYM FOLLOWING_SYM
11601 {
11602
2/4
✓ Branch 0 taken 149 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 149 times.
✗ Branch 3 not taken.
149 $$= NEW_PTN PT_border(WBT_UNBOUNDED_FOLLOWING);
11603 }
11604 | NUM_literal FOLLOWING_SYM
11605 {
11606
2/4
✓ Branch 0 taken 329 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 329 times.
✗ Branch 3 not taken.
329 $$= NEW_PTN PT_border(WBT_VALUE_FOLLOWING, $1);
11607 }
11608 | param_marker FOLLOWING_SYM
11609 {
11610 $$= NEW_PTN PT_border(WBT_VALUE_FOLLOWING, $1);
11611 }
11612 | INTERVAL_SYM expr interval FOLLOWING_SYM
11613 {
11614
2/4
✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 27 times.
✗ Branch 3 not taken.
27 $$= NEW_PTN PT_border(WBT_VALUE_FOLLOWING, $2, $3);
11615 }
11616 ;
11617
11618 opt_window_frame_exclusion:
11619 /* Nothing */
11620 {
11621 1020 $$= NULL;
11622 }
11623 | EXCLUDE_SYM CURRENT_SYM ROW_SYM
11624 {
11625 $$= NEW_PTN PT_exclusion(WFX_CURRENT_ROW);
11626 }
11627 | EXCLUDE_SYM GROUP_SYM
11628 {
11629 $$= NEW_PTN PT_exclusion(WFX_GROUP);
11630 }
11631 | EXCLUDE_SYM TIES_SYM
11632 {
11633 $$= NEW_PTN PT_exclusion(WFX_TIES);
11634 }
11635 | EXCLUDE_SYM NO_SYM OTHERS_SYM
11636 { $$= NEW_PTN PT_exclusion(WFX_NO_OTHERS);
11637 }
11638 ;
11639
11640 window_frame_units:
11641 672 ROWS_SYM { $$= WFU_ROWS; }
11642 348 | RANGE_SYM { $$= WFU_RANGE; }
11643 | GROUPS_SYM { $$= WFU_GROUPS; }
11644 ;
11645
11646 grouping_operation:
11647 GROUPING_SYM '(' expr_list ')'
11648 {
11649
2/4
✓ Branch 0 taken 109 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 109 times.
✗ Branch 3 not taken.
109 $$= NEW_PTN Item_func_grouping(@$, $3);
11650 }
11651 ;
11652
11653 in_expression_user_variable_assignment:
11654 '@' ident_or_text SET_VAR expr
11655 {
11656
2/4
✓ Branch 0 taken 42737 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 42737 times.
✗ Branch 3 not taken.
42737 push_warning(YYTHD, Sql_condition::SL_WARNING,
11657 ER_WARN_DEPRECATED_SYNTAX,
11658 ER_THD(YYTHD, ER_WARN_DEPRECATED_USER_SET_EXPR));
11659
2/4
✓ Branch 0 taken 42737 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 42737 times.
✗ Branch 3 not taken.
42737 $$ = NEW_PTN PTI_variable_aux_set_var(@$, $2, $4);
11660 }
11661 ;
11662
11663 rvalue_system_or_user_variable:
11664 '@' ident_or_text
11665 {
11666
2/4
✓ Branch 0 taken 934957 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 934957 times.
✗ Branch 3 not taken.
934957 $$ = NEW_PTN PTI_user_variable(@$, $2);
11667 }
11668 | '@' '@' opt_rvalue_system_variable_type rvalue_system_variable
11669 {
11670
1/2
✓ Branch 0 taken 671827 times.
✗ Branch 1 not taken.
1343655 $$ = NEW_PTN PTI_get_system_variable(@$, $3,
11671
1/2
✓ Branch 0 taken 671828 times.
✗ Branch 1 not taken.
1343654 @4, $4.prefix, $4.name);
11672 }
11673 ;
11674
11675 opt_distinct:
11676 31729 /* empty */ { $$ = 0; }
11677 15 | DISTINCT { $$ = 1; }
11678 ;
11679
11680 opt_gconcat_separator:
11681 /* empty */
11682 {
11683
1/2
✓ Branch 0 taken 3693 times.
✗ Branch 1 not taken.
3693 $$= NEW_PTN String(",", 1, &my_charset_latin1);
11684
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3693 times.
3693 if ($$ == NULL)
11685 MYSQL_YYABORT;
11686 }
11687 28049 | SEPARATOR_SYM text_string { $$ = $2; }
11688 ;
11689
11690 opt_gorder_clause:
11691 1688 /* empty */ { $$= NULL; }
11692 30055 | ORDER_SYM BY gorder_list { $$= $3; }
11693 ;
11694
11695 gorder_list:
11696 gorder_list ',' order_expr
11697 {
11698
1/2
✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
33 $1->push_back($3);
11699 33 $$= $1;
11700 }
11701 | order_expr
11702 {
11703
1/2
✓ Branch 0 taken 30056 times.
✗ Branch 1 not taken.
60112 $$= NEW_PTN PT_gorder_list();
11704
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 30056 times.
30056 if ($$ == NULL)
11705 MYSQL_YYABORT;
11706
1/2
✓ Branch 0 taken 30056 times.
✗ Branch 1 not taken.
30056 $$->push_back($1);
11707 }
11708 ;
11709
11710 in_sum_expr:
11711 opt_all expr
11712 {
11713
2/4
✓ Branch 0 taken 823971 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 823971 times.
✗ Branch 3 not taken.
823971 $$= NEW_PTN PTI_in_sum_expr(@1, $2);
11714 }
11715 ;
11716
11717 cast_type:
11718 BINARY_SYM opt_field_length
11719 {
11720 1283 $$.target= ITEM_CAST_CHAR;
11721 1283 $$.charset= &my_charset_bin;
11722 1283 $$.length= $2;
11723 1283 $$.dec= NULL;
11724 }
11725 | CHAR_SYM opt_field_length opt_charset_with_opt_binary
11726 {
11727 58574 $$.target= ITEM_CAST_CHAR;
11728 58574 $$.length= $2;
11729 58574 $$.dec= NULL;
11730
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 58570 times.
58574 if ($3.force_binary)
11731 {
11732 // Bugfix: before this patch we ignored [undocumented]
11733 // collation modifier in the CAST(expr, CHAR(...) BINARY) syntax.
11734 // To restore old behavior just remove this "if ($3...)" branch.
11735
11736
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 $$.charset= get_bin_collation($3.charset ? $3.charset :
11737 YYTHD->variables.collation_connection);
11738
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 if ($$.charset == NULL)
11739 MYSQL_YYABORT;
11740 }
11741 else
11742 58570 $$.charset= $3.charset;
11743 }
11744 | nchar opt_field_length
11745 {
11746 28 $$.target= ITEM_CAST_CHAR;
11747 28 $$.charset= national_charset_info;
11748 28 $$.length= $2;
11749 28 $$.dec= NULL;
11750
1/2
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
28 warn_about_deprecated_national(YYTHD);
11751 }
11752 | SIGNED_SYM
11753 {
11754 418 $$.target= ITEM_CAST_SIGNED_INT;
11755 418 $$.charset= NULL;
11756 418 $$.length= NULL;
11757 418 $$.dec= NULL;
11758 }
11759 | SIGNED_SYM INT_SYM
11760 {
11761 3857 $$.target= ITEM_CAST_SIGNED_INT;
11762 3857 $$.charset= NULL;
11763 3857 $$.length= NULL;
11764 3857 $$.dec= NULL;
11765 }
11766 | UNSIGNED_SYM
11767 {
11768 1110115 $$.target= ITEM_CAST_UNSIGNED_INT;
11769 1110115 $$.charset= NULL;
11770 1110115 $$.length= NULL;
11771 1110115 $$.dec= NULL;
11772 }
11773 | UNSIGNED_SYM INT_SYM
11774 {
11775 209 $$.target= ITEM_CAST_UNSIGNED_INT;
11776 209 $$.charset= NULL;
11777 209 $$.length= NULL;
11778 209 $$.dec= NULL;
11779 }
11780 | DATE_SYM
11781 {
11782 1015 $$.target= ITEM_CAST_DATE;
11783 1015 $$.charset= NULL;
11784 1015 $$.length= NULL;
11785 1015 $$.dec= NULL;
11786 }
11787 | YEAR_SYM
11788 {
11789 65 $$.target= ITEM_CAST_YEAR;
11790 65 $$.charset= NULL;
11791 65 $$.length= NULL;
11792 65 $$.dec= NULL;
11793 }
11794 | TIME_SYM type_datetime_precision
11795 {
11796 756 $$.target= ITEM_CAST_TIME;
11797 756 $$.charset= NULL;
11798 756 $$.length= NULL;
11799 756 $$.dec= $2;
11800 }
11801 | DATETIME_SYM type_datetime_precision
11802 {
11803 1098 $$.target= ITEM_CAST_DATETIME;
11804 1098 $$.charset= NULL;
11805 1098 $$.length= NULL;
11806 1098 $$.dec= $2;
11807 }
11808 | DECIMAL_SYM float_options
11809 {
11810 539 $$.target=ITEM_CAST_DECIMAL;
11811 539 $$.charset= NULL;
11812 539 $$.length= $2.length;
11813 539 $$.dec= $2.dec;
11814 }
11815 | JSON_SYM
11816 {
11817 4771 $$.target=ITEM_CAST_JSON;
11818 4771 $$.charset= NULL;
11819 4771 $$.length= NULL;
11820 4771 $$.dec= NULL;
11821 }
11822 | real_type
11823 {
11824
2/2
✓ Branch 0 taken 131 times.
✓ Branch 1 taken 1 times.
132 $$.target = ($1 == Numeric_type::DOUBLE) ?
11825 ITEM_CAST_DOUBLE : ITEM_CAST_FLOAT;
11826 132 $$.charset = nullptr;
11827 132 $$.length = nullptr;
11828 132 $$.dec = nullptr;
11829 }
11830 | FLOAT_SYM standard_float_options
11831 {
11832 65 $$.target = ITEM_CAST_FLOAT;
11833 65 $$.charset = nullptr;
11834 65 $$.length = $2.length;
11835 65 $$.dec = nullptr;
11836 }
11837 | POINT_SYM
11838 {
11839 38 $$.target = ITEM_CAST_POINT;
11840 38 $$.charset = nullptr;
11841 38 $$.length = nullptr;
11842 38 $$.dec = nullptr;
11843 }
11844 | LINESTRING_SYM
11845 {
11846 36 $$.target = ITEM_CAST_LINESTRING;
11847 36 $$.charset = nullptr;
11848 36 $$.length = nullptr;
11849 36 $$.dec = nullptr;
11850 }
11851 | POLYGON_SYM
11852 {
11853 43 $$.target = ITEM_CAST_POLYGON;
11854 43 $$.charset = nullptr;
11855 43 $$.length = nullptr;
11856 43 $$.dec = nullptr;
11857 }
11858 | MULTIPOINT_SYM
11859 {
11860 30 $$.target = ITEM_CAST_MULTIPOINT;
11861 30 $$.charset = nullptr;
11862 30 $$.length = nullptr;
11863 30 $$.dec = nullptr;
11864 }
11865 | MULTILINESTRING_SYM
11866 {
11867 36 $$.target = ITEM_CAST_MULTILINESTRING;
11868 36 $$.charset = nullptr;
11869 36 $$.length = nullptr;
11870 36 $$.dec = nullptr;
11871 }
11872 | MULTIPOLYGON_SYM
11873 {
11874 35 $$.target = ITEM_CAST_MULTIPOLYGON;
11875 35 $$.charset = nullptr;
11876 35 $$.length = nullptr;
11877 35 $$.dec = nullptr;
11878 }
11879 | GEOMETRYCOLLECTION_SYM
11880 {
11881 41 $$.target = ITEM_CAST_GEOMETRYCOLLECTION;
11882 41 $$.charset = nullptr;
11883 41 $$.length = nullptr;
11884 41 $$.dec = nullptr;
11885 }
11886 ;
11887
11888 opt_expr_list:
11889 135103 /* empty */ { $$= NULL; }
11890 | expr_list
11891 ;
11892
11893 expr_list:
11894 expr
11895 {
11896
2/4
✓ Branch 0 taken 2526098 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2526098 times.
✗ Branch 3 not taken.
2526098 $$= NEW_PTN PT_item_list;
11897
4/8
✓ Branch 0 taken 2526098 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2526098 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2526098 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2526098 times.
2526098 if ($$ == NULL || $$->push_back($1))
11898 MYSQL_YYABORT;
11899 }
11900 | expr_list ',' expr
11901 {
11902
4/8
✓ Branch 0 taken 2420495 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2420495 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2420495 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2420495 times.
2420495 if ($1 == NULL || $1->push_back($3))
11903 MYSQL_YYABORT;
11904 2420495 $$= $1;
11905 }
11906 ;
11907
11908 ident_list_arg:
11909 315 ident_list { $$= $1; }
11910 2484 | '(' ident_list ')' { $$= $2; }
11911 ;
11912
11913 ident_list:
11914 simple_ident
11915 {
11916
2/4
✓ Branch 0 taken 2799 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2799 times.
✗ Branch 3 not taken.
2799 $$= NEW_PTN PT_item_list;
11917
4/8
✓ Branch 0 taken 2799 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2799 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2799 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2799 times.
2799 if ($$ == NULL || $$->push_back($1))
11918 MYSQL_YYABORT;
11919 }
11920 | ident_list ',' simple_ident
11921 {
11922
4/8
✓ Branch 0 taken 1332 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1332 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1332 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1332 times.
1332 if ($1 == NULL || $1->push_back($3))
11923 MYSQL_YYABORT;
11924 1332 $$= $1;
11925 }
11926 ;
11927
11928 opt_expr:
11929 17070 /* empty */ { $$= NULL; }
11930 293108 | expr { $$= $1; }
11931 ;
11932
11933 opt_else:
11934 2039 /* empty */ { $$= NULL; }
11935 308139 | ELSE expr { $$= $2; }
11936 ;
11937
11938 when_list:
11939 WHEN_SYM expr THEN_SYM expr
11940 {
11941
1/2
✓ Branch 0 taken 310178 times.
✗ Branch 1 not taken.
310178 $$= new (YYMEM_ROOT) mem_root_deque<Item *>(YYMEM_ROOT);
11942
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 310178 times.
310178 if ($$ == NULL)
11943 MYSQL_YYABORT;
11944
1/2
✓ Branch 0 taken 310178 times.
✗ Branch 1 not taken.
310178 $$->push_back($2);
11945
1/2
✓ Branch 0 taken 310178 times.
✗ Branch 1 not taken.
310178 $$->push_back($4);
11946 }
11947 | when_list WHEN_SYM expr THEN_SYM expr
11948 {
11949
1/2
✓ Branch 0 taken 2112587 times.
✗ Branch 1 not taken.
2112587 $1->push_back($3);
11950
1/2
✓ Branch 0 taken 2112587 times.
✗ Branch 1 not taken.
2112587 $1->push_back($5);
11951 2112587 $$= $1;
11952 }
11953 ;
11954
11955 table_reference:
11956 6865563 table_factor { $$= $1; }
11957 124158 | joined_table { $$= $1; }
11958 | '{' OJ_SYM esc_table_reference '}'
11959 {
11960 /*
11961 The ODBC escape syntax for Outer Join.
11962
11963 All productions from table_factor and joined_table can be escaped,
11964 not only the '{LEFT | RIGHT} [OUTER] JOIN' syntax.
11965 */
11966 18 $$ = $3;
11967 }
11968 ;
11969
11970 esc_table_reference:
11971 2 table_factor { $$= $1; }
11972 16 | joined_table { $$= $1; }
11973 ;
11974 /*
11975 Join operations are normally left-associative, as in
11976
11977 t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t3.a = t2.a
11978
11979 This is equivalent to
11980
11981 (t1 JOIN t2 ON t1.a = t2.a) JOIN t3 ON t3.a = t2.a
11982
11983 They can also be right-associative without parentheses, e.g.
11984
11985 t1 JOIN t2 JOIN t3 ON t2.a = t3.a ON t1.a = t2.a
11986
11987 Which is equivalent to
11988
11989 t1 JOIN (t2 JOIN t3 ON t2.a = t3.a) ON t1.a = t2.a
11990
11991 In MySQL, JOIN and CROSS JOIN mean the same thing, i.e.:
11992
11993 - A join without a <join specification> is the same as a cross join.
11994 - A cross join with a <join specification> is the same as an inner join.
11995
11996 For the join operation above, this means that the parser can't know until it
11997 has seen the last ON whether `t1 JOIN t2` was a cross join or not. The only
11998 way to solve the abiguity is to keep shifting the tokens on the stack, and
11999 not reduce until the last ON is seen. We tell Bison this by adding a fake
12000 token CONDITIONLESS_JOIN which has lower precedence than all tokens that
12001 would continue the join. These are JOIN_SYM, INNER_SYM, CROSS,
12002 STRAIGHT_JOIN, NATURAL, LEFT, RIGHT, ON and USING. This way the automaton
12003 only reduces to a cross join unless no other interpretation is
12004 possible. This gives a right-deep join tree for join *with* conditions,
12005 which is what is expected.
12006
12007 The challenge here is that t1 JOIN t2 *could* have been a cross join, we
12008 just don't know it until afterwards. So if the query had been
12009
12010 t1 JOIN t2 JOIN t3 ON t2.a = t3.a
12011
12012 we will first reduce `t2 JOIN t3 ON t2.a = t3.a` to a <table_reference>,
12013 which is correct, but a problem arises when reducing t1 JOIN
12014 <table_reference>. If we were to do that, we'd get a right-deep tree. The
12015 solution is to build the tree downwards instead of upwards, as is normally
12016 done. This concept may seem outlandish at first, but it's really quite
12017 simple. When the semantic action for table_reference JOIN table_reference is
12018 executed, the parse tree is (please pardon the ASCII graphic):
12019
12020 JOIN ON t2.a = t3.a
12021 / \
12022 t2 t3
12023
12024 Now, normally we'd just add the cross join node on top of this tree, as:
12025
12026 JOIN
12027 / \
12028 t1 JOIN ON t2.a = t3.a
12029 / \
12030 t2 t3
12031
12032 This is not the meaning of the query, however. The cross join should be
12033 addded at the bottom:
12034
12035
12036 JOIN ON t2.a = t3.a
12037 / \
12038 JOIN t3
12039 / \
12040 t1 t2
12041
12042 There is only one rule to pay attention to: If the right-hand side of a
12043 cross join is a join tree, find its left-most leaf (which is a table
12044 name). Then replace this table name with a cross join of the left-hand side
12045 of the top cross join, and the right hand side with the original table.
12046
12047 Natural joins are also syntactically conditionless, but we need to make sure
12048 that they are never right associative. We handle them in their own rule
12049 natural_join, which is left-associative only. In this case we know that
12050 there is no join condition to wait for, so we can reduce immediately.
12051 */
12052 joined_table:
12053 table_reference inner_join_type table_reference ON_SYM expr
12054 {
12055
2/4
✓ Branch 0 taken 1661836 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1661836 times.
✗ Branch 3 not taken.
1661836 $$= NEW_PTN PT_joined_table_on($1, @2, $2, $3, $5);
12056 }
12057 | table_reference inner_join_type table_reference USING
12058 '(' using_list ')'
12059 {
12060
2/4
✓ Branch 0 taken 5104 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5104 times.
✗ Branch 3 not taken.
5104 $$= NEW_PTN PT_joined_table_using($1, @2, $2, $3, $6);
12061 }
12062 | table_reference outer_join_type table_reference ON_SYM expr
12063 {
12064
2/4
✓ Branch 0 taken 445339 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 445339 times.
✗ Branch 3 not taken.
445339 $$= NEW_PTN PT_joined_table_on($1, @2, $2, $3, $5);
12065 }
12066 | table_reference outer_join_type table_reference USING '(' using_list ')'
12067 {
12068
2/4
✓ Branch 0 taken 6662 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6662 times.
✗ Branch 3 not taken.
6662 $$= NEW_PTN PT_joined_table_using($1, @2, $2, $3, $6);
12069 }
12070 | table_reference inner_join_type table_reference
12071 %prec CONDITIONLESS_JOIN
12072 {
12073
2/4
✓ Branch 0 taken 6802 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6802 times.
✗ Branch 3 not taken.
6802 auto this_cross_join= NEW_PTN PT_cross_join($1, @2, $2, NULL);
12074
12075
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6802 times.
6802 if ($3 == NULL)
12076 MYSQL_YYABORT; // OOM
12077
12078
1/2
✓ Branch 0 taken 6802 times.
✗ Branch 1 not taken.
6802 $$= $3->add_cross_join(this_cross_join);
12079 }
12080 | table_reference natural_join_type table_factor
12081 {
12082
2/4
✓ Branch 0 taken 2175 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2175 times.
✗ Branch 3 not taken.
2175 $$= NEW_PTN PT_joined_table_using($1, @2, $2, $3);
12083 }
12084 ;
12085
12086 natural_join_type:
12087 293 NATURAL opt_inner JOIN_SYM { $$= JTT_NATURAL_INNER; }
12088 906 | NATURAL RIGHT opt_outer JOIN_SYM { $$= JTT_NATURAL_RIGHT; }
12089 976 | NATURAL LEFT opt_outer JOIN_SYM { $$= JTT_NATURAL_LEFT; }
12090 ;
12091
12092 inner_join_type:
12093 1660553 JOIN_SYM { $$= JTT_INNER; }
12094 11342 | INNER_SYM JOIN_SYM { $$= JTT_INNER; }
12095 795 | CROSS JOIN_SYM { $$= JTT_INNER; }
12096 1053 | STRAIGHT_JOIN { $$= JTT_STRAIGHT_INNER; }
12097
12098 outer_join_type:
12099 449520 LEFT opt_outer JOIN_SYM { $$= JTT_LEFT; }
12100 2489 | RIGHT opt_outer JOIN_SYM { $$= JTT_RIGHT; }
12101 ;
12102
12103 opt_inner:
12104 /* empty */
12105 | INNER_SYM
12106 ;
12107
12108 opt_outer:
12109 /* empty */
12110 | OUTER_SYM
12111 ;
12112
12113 /*
12114 table PARTITION (list of partitions), reusing using_list instead of creating
12115 a new rule for partition_list.
12116 */
12117 opt_use_partition:
12118 13993633 /* empty */ { $$= NULL; }
12119 | use_partition
12120 ;
12121
12122 use_partition:
12123 PARTITION_SYM '(' using_list ')'
12124 {
12125 1283 $$= $3;
12126 }
12127 ;
12128
12129 /**
12130 MySQL has a syntax extension where a comma-separated list of table
12131 references is allowed as a table reference in itself, for instance
12132
12133 SELECT * FROM (t1, t2) JOIN t3 ON 1
12134
12135 which is not allowed in standard SQL. The syntax is equivalent to
12136
12137 SELECT * FROM (t1 CROSS JOIN t2) JOIN t3 ON 1
12138
12139 We call this rule table_reference_list_parens.
12140
12141 A <table_factor> may be a <single_table>, a <subquery>, a <derived_table>, a
12142 <joined_table>, or the bespoke <table_reference_list_parens>, each of those
12143 enclosed in any number of parentheses. This makes for an ambiguous grammar
12144 since a <table_factor> may also be enclosed in parentheses. We get around
12145 this by designing the grammar so that a <table_factor> does not have
12146 parentheses, but all the sub-cases of it have their own parentheses-rules,
12147 i.e. <single_table_parens>, <joined_table_parens> and
12148 <table_reference_list_parens>. It's a bit tedious but the grammar is
12149 unambiguous and doesn't have shift/reduce conflicts.
12150 */
12151 table_factor:
12152 single_table
12153 | single_table_parens
12154 11087 | derived_table { $$ = $1; }
12155 | joined_table_parens
12156
2/4
✓ Branch 0 taken 2003744 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2003744 times.
✗ Branch 3 not taken.
2003744 { $$= NEW_PTN PT_table_factor_joined_table($1); }
12157 | table_reference_list_parens
12158
2/4
✓ Branch 0 taken 431 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 431 times.
✗ Branch 3 not taken.
431 { $$= NEW_PTN PT_table_reference_list_parens($1); }
12159 6894 | table_function { $$ = $1; }
12160 ;
12161
12162 table_reference_list_parens:
12163 9 '(' table_reference_list_parens ')' { $$= $2; }
12164 | '(' table_reference_list ',' table_reference ')'
12165 {
12166 431 $$= $2;
12167
2/4
✓ Branch 0 taken 431 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 431 times.
431 if ($$.push_back($4))
12168 MYSQL_YYABORT; // OOM
12169 }
12170 ;
12171
12172 single_table_parens:
12173 2 '(' single_table_parens ')' { $$= $2; }
12174 20 | '(' single_table ')' { $$= $2; }
12175 ;
12176
12177 single_table:
12178 table_ident opt_use_partition opt_table_alias opt_key_definition
12179 {
12180
2/4
✓ Branch 0 taken 4845589 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4845591 times.
✗ Branch 3 not taken.
4845586 $$= NEW_PTN PT_table_factor_table_ident($1, $2, $3, $4);
12181 }
12182 ;
12183
12184 joined_table_parens:
12185 27 '(' joined_table_parens ')' { $$= $2; }
12186 2003744 | '(' joined_table ')' { $$= $2; }
12187 ;
12188
12189 derived_table:
12190 table_subquery opt_table_alias opt_derived_column_list
12191 {
12192 /*
12193 The alias is actually not optional at all, but being MySQL we
12194 are friendly and give an informative error message instead of
12195 just 'syntax error'.
12196 */
12197
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 9609 times.
9623 if ($2.str == nullptr)
12198
2/4
✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
✗ Branch 3 not taken.
14 my_message(ER_DERIVED_MUST_HAVE_ALIAS,
12199 ER_THD(YYTHD, ER_DERIVED_MUST_HAVE_ALIAS), MYF(0));
12200
12201
2/4
✓ Branch 0 taken 9623 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9623 times.
✗ Branch 3 not taken.
9623 $$= NEW_PTN PT_derived_table(false, $1, $2, &$3);
12202 }
12203 | LATERAL_SYM table_subquery opt_table_alias opt_derived_column_list
12204 {
12205
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1464 times.
1464 if ($3.str == nullptr)
12206 my_message(ER_DERIVED_MUST_HAVE_ALIAS,
12207 ER_THD(YYTHD, ER_DERIVED_MUST_HAVE_ALIAS), MYF(0));
12208
12209
2/4
✓ Branch 0 taken 1464 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1464 times.
✗ Branch 3 not taken.
1464 $$= NEW_PTN PT_derived_table(true, $2, $3, &$4);
12210 }
12211 ;
12212
12213 table_function:
12214 JSON_TABLE_SYM '(' expr ',' text_literal columns_clause ')'
12215 opt_table_alias
12216 {
12217 // Alias isn't optional, follow derived's behavior
12218
3/4
✓ Branch 0 taken 6736 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 6735 times.
6736 if ($8 == NULL_CSTR)
12219 {
12220
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 my_message(ER_TF_MUST_HAVE_ALIAS,
12221 ER_THD(YYTHD, ER_TF_MUST_HAVE_ALIAS), MYF(0));
12222 1 MYSQL_YYABORT;
12223 }
12224
12225
2/4
✓ Branch 0 taken 6735 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6735 times.
✗ Branch 3 not taken.
6735 $$= NEW_PTN PT_table_factor_function($3, $5, $6, to_lex_string($8));
12226 }
12227 | SEQUENCE_TABLE_SYM '(' expr ')' opt_table_alias
12228 {
12229 // Alias isn't optional, follow derived's behavior
12230
3/4
✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 159 times.
160 if ($5 == NULL_CSTR)
12231 {
12232
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 my_message(ER_TF_MUST_HAVE_ALIAS,
12233 ER_THD(YYTHD, ER_TF_MUST_HAVE_ALIAS), MYF(0));
12234 1 MYSQL_YYABORT;
12235 }
12236
2/4
✓ Branch 0 taken 159 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 159 times.
✗ Branch 3 not taken.
159 $$= NEW_PTN PT_table_sequence_function($3, $5);
12237 }
12238 ;
12239
12240 columns_clause:
12241 COLUMNS '(' columns_list ')'
12242 {
12243 6785 $$= $3;
12244 }
12245 ;
12246
12247 columns_list:
12248 jt_column
12249 {
12250
2/4
✓ Branch 0 taken 6785 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6785 times.
✗ Branch 3 not taken.
6785 $$= NEW_PTN Mem_root_array<PT_json_table_column *>(YYMEM_ROOT);
12251
4/8
✓ Branch 0 taken 6785 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6785 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 6785 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 6785 times.
6785 if ($$ == NULL || $$->push_back($1))
12252 MYSQL_YYABORT; // OOM
12253 }
12254 | columns_list ',' jt_column
12255 {
12256 7667 $$= $1;
12257
2/4
✓ Branch 0 taken 7667 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7667 times.
7667 if ($$->push_back($3))
12258 MYSQL_YYABORT; // OOM
12259 }
12260 ;
12261
12262 jt_column:
12263 ident FOR_SYM ORDINALITY_SYM
12264 {
12265
2/4
✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 189 times.
✗ Branch 3 not taken.
189 $$= NEW_PTN PT_json_table_column_for_ordinality($1);
12266 }
12267 | ident type opt_collate jt_column_type PATH_SYM text_literal
12268 opt_on_empty_or_error_json_table
12269 {
12270 auto column = make_unique_destroy_only<Json_table_column>(
12271 14214 YYMEM_ROOT, $4, $6, $7.error.type, $7.error.default_string,
12272
1/2
✓ Branch 0 taken 14214 times.
✗ Branch 1 not taken.
14214 $7.empty.type, $7.empty.default_string);
12273
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14214 times.
14214 if (column == nullptr) MYSQL_YYABORT; // OOM
12274
1/2
✓ Branch 0 taken 14214 times.
✗ Branch 1 not taken.
42642 $$ = NEW_PTN PT_json_table_column_with_path(std::move(column), $1,
12275
1/2
✓ Branch 0 taken 14214 times.
✗ Branch 1 not taken.
28428 $2, $3);
12276
1/2
✓ Branch 0 taken 14214 times.
✗ Branch 1 not taken.
14214 }
12277 | NESTED_SYM PATH_SYM text_literal columns_clause
12278 {
12279
2/4
✓ Branch 0 taken 49 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 49 times.
✗ Branch 3 not taken.
49 $$= NEW_PTN PT_json_table_column_with_nested_path($3, $4);
12280 }
12281 ;
12282
12283 jt_column_type:
12284 {
12285 14179 $$= enum_jt_column::JTC_PATH;
12286 }
12287 | EXISTS
12288 {
12289 37 $$= enum_jt_column::JTC_EXISTS;
12290 }
12291 ;
12292
12293 // The optional ON EMPTY and ON ERROR clauses for JSON_TABLE and
12294 // JSON_VALUE. If both clauses are specified, the ON EMPTY clause
12295 // should come before the ON ERROR clause.
12296 opt_on_empty_or_error:
12297 /* empty */
12298 {
12299 14139 $$.empty = {Json_on_response_type::IMPLICIT, nullptr};
12300 14139 $$.error = {Json_on_response_type::IMPLICIT, nullptr};
12301 }
12302 | on_empty
12303 {
12304 49 $$.empty = $1;
12305 49 $$.error = {Json_on_response_type::IMPLICIT, nullptr};
12306 }
12307 | on_error
12308 {
12309 20 $$.error = $1;
12310 20 $$.empty = {Json_on_response_type::IMPLICIT, nullptr};
12311 }
12312 | on_empty on_error
12313 {
12314 13 $$.empty = $1;
12315 13 $$.error = $2;
12316 }
12317 ;
12318
12319 // JSON_TABLE extends the syntax by allowing ON ERROR to come before ON EMPTY.
12320 opt_on_empty_or_error_json_table:
12321 14211 opt_on_empty_or_error { $$ = $1; }
12322 | on_error on_empty
12323 {
12324
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 push_warning(
12325 YYTHD, Sql_condition::SL_WARNING, ER_WARN_DEPRECATED_SYNTAX,
12326 ER_THD(YYTHD, ER_WARN_DEPRECATED_JSON_TABLE_ON_ERROR_ON_EMPTY));
12327 3 $$.error = $1;
12328 3 $$.empty = $2;
12329 }
12330 ;
12331
12332 on_empty:
12333 65 json_on_response ON_SYM EMPTY_SYM { $$= $1; }
12334 ;
12335 on_error:
12336 36 json_on_response ON_SYM ERROR_SYM { $$= $1; }
12337 ;
12338 json_on_response:
12339 ERROR_SYM
12340 {
12341 15 $$ = {Json_on_response_type::ERROR, nullptr};
12342 }
12343 | NULL_SYM
12344 {
12345 3 $$ = {Json_on_response_type::NULL_VALUE, nullptr};
12346 }
12347 | DEFAULT_SYM signed_literal
12348 {
12349 83 $$ = {Json_on_response_type::DEFAULT, $2};
12350 }
12351 ;
12352
12353 index_hint_clause:
12354 /* empty */
12355 {
12356
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9066 times.
9066 $$= old_mode ? INDEX_HINT_MASK_JOIN : INDEX_HINT_MASK_ALL;
12357 }
12358 15 | FOR_SYM JOIN_SYM { $$= INDEX_HINT_MASK_JOIN; }
12359 56 | FOR_SYM ORDER_SYM BY { $$= INDEX_HINT_MASK_ORDER; }
12360 30 | FOR_SYM GROUP_SYM BY { $$= INDEX_HINT_MASK_GROUP; }
12361 ;
12362
12363 index_hint_type:
12364 6918 FORCE_SYM { $$= INDEX_HINT_FORCE; }
12365 829 | IGNORE_SYM { $$= INDEX_HINT_IGNORE; }
12366 ;
12367
12368 index_hint_definition:
12369 index_hint_type key_or_index index_hint_clause
12370 '(' key_usage_list ')'
12371 {
12372
1/2
✓ Branch 0 taken 7745 times.
✗ Branch 1 not taken.
7745 init_index_hints($5, $1, $3);
12373 7745 $$= $5;
12374 }
12375 | USE_SYM key_or_index index_hint_clause
12376 '(' opt_key_usage_list ')'
12377 {
12378
1/2
✓ Branch 0 taken 1420 times.
✗ Branch 1 not taken.
1420 init_index_hints($5, INDEX_HINT_USE, $3);
12379 1420 $$= $5;
12380 }
12381 ;
12382
12383 index_hints_list:
12384 index_hint_definition
12385 | index_hints_list index_hint_definition
12386 {
12387
1/2
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
17 $2->concat($1);
12388 17 $$= $2;
12389 }
12390 ;
12391
12392 opt_index_hints_list:
12393 4836439 /* empty */ { $$= NULL; }
12394 | index_hints_list
12395 ;
12396
12397 opt_key_definition:
12398 opt_index_hints_list
12399 ;
12400
12401 opt_key_usage_list:
12402 /* empty */
12403 {
12404
1/2
✓ Branch 0 taken 1281 times.
✗ Branch 1 not taken.
1281 $$= NEW_PTN List<Index_hint>;
12405
1/2
✓ Branch 0 taken 1281 times.
✗ Branch 1 not taken.
1281 Index_hint *hint= NEW_PTN Index_hint(NULL, 0);
12406
5/10
✓ Branch 0 taken 1281 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1281 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1281 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1281 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1281 times.
1281 if ($$ == NULL || hint == NULL || $$->push_front(hint))
12407 MYSQL_YYABORT;
12408 }
12409 | key_usage_list
12410 ;
12411
12412 key_usage_element:
12413 ident
12414 {
12415
1/2
✓ Branch 0 taken 7534 times.
✗ Branch 1 not taken.
7534 $$= NEW_PTN Index_hint($1.str, $1.length);
12416
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7534 times.
7534 if ($$ == NULL)
12417 MYSQL_YYABORT;
12418 }
12419 | PRIMARY_SYM
12420 {
12421
1/2
✓ Branch 0 taken 644 times.
✗ Branch 1 not taken.
644 $$= NEW_PTN Index_hint(STRING_WITH_LEN("PRIMARY"));
12422
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 644 times.
644 if ($$ == NULL)
12423 MYSQL_YYABORT;
12424 }
12425 ;
12426
12427 key_usage_list:
12428 key_usage_element
12429 {
12430
1/2
✓ Branch 0 taken 7895 times.
✗ Branch 1 not taken.
7895 $$= NEW_PTN List<Index_hint>;
12431
4/8
✓ Branch 0 taken 7895 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7895 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 7895 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 7895 times.
7895 if ($$ == NULL || $$->push_front($1))
12432 MYSQL_YYABORT;
12433 }
12434 | key_usage_list ',' key_usage_element
12435 {
12436
2/4
✓ Branch 0 taken 283 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 283 times.
283 if ($$->push_front($3))
12437 MYSQL_YYABORT;
12438 }
12439 ;
12440
12441 using_list:
12442 ident_string_list
12443 ;
12444
12445 ident_string_list:
12446 ident
12447 {
12448
1/2
✓ Branch 0 taken 14762 times.
✗ Branch 1 not taken.
14762 $$= NEW_PTN List<String>;
12449 14762 String *s= NEW_PTN String(const_cast<const char *>($1.str),
12450 $1.length,
12451
1/2
✓ Branch 0 taken 14762 times.
✗ Branch 1 not taken.
14762 system_charset_info);
12452
5/10
✓ Branch 0 taken 14762 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14762 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 14762 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 14762 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 14762 times.
14762 if ($$ == NULL || s == NULL || $$->push_back(s))
12453 MYSQL_YYABORT;
12454 }
12455 | ident_string_list ',' ident
12456 {
12457 1766 String *s= NEW_PTN String(const_cast<const char *>($3.str),
12458 $3.length,
12459
1/2
✓ Branch 0 taken 1766 times.
✗ Branch 1 not taken.
1766 system_charset_info);
12460
4/8
✓ Branch 0 taken 1766 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1766 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1766 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1766 times.
1766 if (s == NULL || $1->push_back(s))
12461 MYSQL_YYABORT;
12462 1766 $$= $1;
12463 }
12464 ;
12465
12466 interval:
12467 interval_time_stamp {}
12468 17 | DAY_HOUR_SYM { $$=INTERVAL_DAY_HOUR; }
12469 17 | DAY_MICROSECOND_SYM { $$=INTERVAL_DAY_MICROSECOND; }
12470 20 | DAY_MINUTE_SYM { $$=INTERVAL_DAY_MINUTE; }
12471 25 | DAY_SECOND_SYM { $$=INTERVAL_DAY_SECOND; }
12472 17 | HOUR_MICROSECOND_SYM { $$=INTERVAL_HOUR_MICROSECOND; }
12473 18 | HOUR_MINUTE_SYM { $$=INTERVAL_HOUR_MINUTE; }
12474 22 | HOUR_SECOND_SYM { $$=INTERVAL_HOUR_SECOND; }
12475 16 | MINUTE_MICROSECOND_SYM { $$=INTERVAL_MINUTE_MICROSECOND; }
12476 31 | MINUTE_SECOND_SYM { $$=INTERVAL_MINUTE_SECOND; }
12477 15 | SECOND_MICROSECOND_SYM { $$=INTERVAL_SECOND_MICROSECOND; }
12478 26 | YEAR_MONTH_SYM { $$=INTERVAL_YEAR_MONTH; }
12479 ;
12480
12481 interval_time_stamp:
12482 438 DAY_SYM { $$=INTERVAL_DAY; }
12483 66 | WEEK_SYM { $$=INTERVAL_WEEK; }
12484 218 | HOUR_SYM { $$=INTERVAL_HOUR; }
12485 258 | MINUTE_SYM { $$=INTERVAL_MINUTE; }
12486 267 | MONTH_SYM { $$=INTERVAL_MONTH; }
12487 28 | QUARTER_SYM { $$=INTERVAL_QUARTER; }
12488 12669 | SECOND_SYM { $$=INTERVAL_SECOND; }
12489 82 | MICROSECOND_SYM { $$=INTERVAL_MICROSECOND; }
12490 149 | YEAR_SYM { $$=INTERVAL_YEAR; }
12491 ;
12492
12493 date_time_type:
12494 21 DATE_SYM {$$= MYSQL_TIMESTAMP_DATE; }
12495 2 | TIME_SYM {$$= MYSQL_TIMESTAMP_TIME; }
12496 1 | TIMESTAMP_SYM {$$= MYSQL_TIMESTAMP_DATETIME; }
12497 4 | DATETIME_SYM {$$= MYSQL_TIMESTAMP_DATETIME; }
12498 ;
12499
12500 opt_as:
12501 /* empty */
12502 | AS
12503 ;
12504
12505 opt_table_alias:
12506 2127534 /* empty */ { $$ = NULL_CSTR; }
12507 2788282 | opt_as ident { $$ = to_lex_cstring($2); }
12508 ;
12509
12510 opt_all:
12511 /* empty */
12512 | ALL
12513 ;
12514
12515 opt_where_clause:
12516 8899059 /* empty */ { $$ = nullptr; }
12517 | where_clause
12518 ;
12519
12520 where_clause:
12521
2/4
✓ Branch 0 taken 1874373 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1874385 times.
✗ Branch 3 not taken.
1874391 WHERE expr { $$ = NEW_PTN PTI_where(@2, $2); }
12522 ;
12523
12524 opt_having_clause:
12525 10354497 /* empty */ { $$= NULL; }
12526 | HAVING expr
12527 {
12528
2/4
✓ Branch 0 taken 6642 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6642 times.
✗ Branch 3 not taken.
6642 $$= new PTI_having(@$, $2);
12529 }
12530 ;
12531
12532 with_clause:
12533 WITH with_list
12534 {
12535
2/4
✓ Branch 0 taken 649 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 649 times.
✗ Branch 3 not taken.
649 $$= NEW_PTN PT_with_clause($2, false);
12536 }
12537 | WITH RECURSIVE_SYM with_list
12538 {
12539
2/4
✓ Branch 0 taken 5165 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5165 times.
✗ Branch 3 not taken.
5165 $$= NEW_PTN PT_with_clause($3, true);
12540 }
12541 ;
12542
12543 with_list:
12544 with_list ',' common_table_expr
12545 {
12546
3/4
✓ Branch 0 taken 182 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 178 times.
182 if ($1->push_back($3))
12547 4 MYSQL_YYABORT;
12548 }
12549 | common_table_expr
12550 {
12551
2/4
✓ Branch 0 taken 5820 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5820 times.
✗ Branch 3 not taken.
5820 $$= NEW_PTN PT_with_list(YYTHD->mem_root);
12552
4/8
✓ Branch 0 taken 5820 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5820 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5820 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5820 times.
5820 if ($$ == NULL || $$->push_back($1))
12553 MYSQL_YYABORT; /* purecov: inspected */
12554 }
12555 ;
12556
12557 common_table_expr:
12558 ident opt_derived_column_list AS table_subquery
12559 {
12560 LEX_STRING subq_text;
12561 6002 subq_text.length= @4.cpp.length();
12562
1/2
✓ Branch 0 taken 6002 times.
✗ Branch 1 not taken.
6002 subq_text.str= YYTHD->strmake(@4.cpp.start, subq_text.length);
12563
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6002 times.
6002 if (subq_text.str == NULL)
12564 MYSQL_YYABORT; /* purecov: inspected */
12565 6002 uint subq_text_offset= @4.cpp.start - YYLIP->get_cpp_buf();
12566 12004 $$= NEW_PTN PT_common_table_expr($1, subq_text, subq_text_offset,
12567
2/4
✓ Branch 0 taken 6002 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6002 times.
✗ Branch 3 not taken.
6002 $4, &$2, YYTHD->mem_root);
12568
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6002 times.
6002 if ($$ == NULL)
12569 MYSQL_YYABORT; /* purecov: inspected */
12570 }
12571 ;
12572
12573 opt_derived_column_list:
12574 /* empty */
12575 {
12576 /*
12577 Because () isn't accepted by the rule of
12578 simple_ident_list, we can use an empty array to
12579 designates that the parenthesised list was omitted.
12580 */
12581 45430 $$.init(YYTHD->mem_root);
12582 }
12583 | '(' simple_ident_list ')'
12584 {
12585 48981 $$= $2;
12586 }
12587 ;
12588
12589 simple_ident_list:
12590 ident
12591 {
12592 48981 $$.init(YYTHD->mem_root);
12593
2/4
✓ Branch 0 taken 48981 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 48981 times.
48981 if ($$.push_back(to_lex_cstring($1)))
12594 MYSQL_YYABORT; /* purecov: inspected */
12595 }
12596 | simple_ident_list ',' ident
12597 {
12598 415020 $$= $1;
12599
2/4
✓ Branch 0 taken 415020 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 415020 times.
415020 if ($$.push_back(to_lex_cstring($3)))
12600 MYSQL_YYABORT; /* purecov: inspected */
12601 }
12602 ;
12603
12604 opt_window_clause:
12605 /* Nothing */
12606 {
12607 10360544 $$= NULL;
12608 }
12609 | WINDOW_SYM window_definition_list
12610 {
12611 590 $$= $2;
12612 }
12613 ;
12614
12615 window_definition_list:
12616 window_definition
12617 {
12618
1/2
✓ Branch 0 taken 590 times.
✗ Branch 1 not taken.
1180 $$= NEW_PTN PT_window_list();
12619
4/8
✓ Branch 0 taken 590 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 590 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 590 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 590 times.
590 if ($$ == NULL || $$->push_back($1))
12620 MYSQL_YYABORT; // OOM
12621 }
12622 | window_definition_list ',' window_definition
12623 {
12624
2/4
✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 44 times.
44 if ($1->push_back($3))
12625 MYSQL_YYABORT; // OOM
12626 44 $$= $1;
12627 }
12628 ;
12629
12630 window_definition:
12631 window_name AS window_spec
12632 {
12633 634 $$= $3;
12634
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 634 times.
634 if ($$ == NULL)
12635 MYSQL_YYABORT; // OOM
12636 634 $$->set_name($1);
12637 }
12638 ;
12639
12640 /*
12641 group by statement in select
12642 */
12643
12644 opt_group_clause:
12645 10237988 /* empty */ { $$= NULL; }
12646 | GROUP_SYM BY group_list olap_opt
12647 {
12648
2/4
✓ Branch 0 taken 123143 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 123143 times.
✗ Branch 3 not taken.
123143 $$= NEW_PTN PT_group($3, $4);
12649 }
12650 ;
12651
12652 group_list:
12653 group_list ',' grouping_expr
12654 {
12655
1/2
✓ Branch 0 taken 64902 times.
✗ Branch 1 not taken.
64902 $1->push_back($3);
12656 64902 $$= $1;
12657 }
12658 | grouping_expr
12659 {
12660
1/2
✓ Branch 0 taken 123627 times.
✗ Branch 1 not taken.
247254 $$= NEW_PTN PT_order_list();
12661
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 123627 times.
123627 if ($$ == NULL)
12662 MYSQL_YYABORT;
12663
1/2
✓ Branch 0 taken 123627 times.
✗ Branch 1 not taken.
123627 $$->push_back($1);
12664 }
12665 ;
12666
12667
12668 olap_opt:
12669 122772 /* empty */ { $$= UNSPECIFIED_OLAP_TYPE; }
12670 371 | WITH_ROLLUP_SYM { $$= ROLLUP_TYPE; }
12671 /*
12672 'WITH ROLLUP' is needed for backward compatibility,
12673 and cause LALR(2) conflicts.
12674 This syntax is not standard.
12675 MySQL syntax: GROUP BY col1, col2, col3 WITH ROLLUP
12676 SQL-2003: GROUP BY ... ROLLUP(col1, col2, col3)
12677 */
12678 ;
12679
12680 /*
12681 Order by statement in ALTER TABLE
12682 */
12683
12684 alter_order_list:
12685 alter_order_list ',' alter_order_item
12686 {
12687 58 $$= $1;
12688
1/2
✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
58 $$->push_back($3);
12689 }
12690 | alter_order_item
12691 {
12692
1/2
✓ Branch 0 taken 62 times.
✗ Branch 1 not taken.
124 $$= NEW_PTN PT_order_list();
12693
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 62 times.
62 if ($$ == NULL)
12694 MYSQL_YYABORT;
12695
1/2
✓ Branch 0 taken 62 times.
✗ Branch 1 not taken.
62 $$->push_back($1);
12696 }
12697 ;
12698
12699 alter_order_item:
12700 simple_ident_nospvar opt_ordering_direction
12701 {
12702
2/4
✓ Branch 0 taken 120 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 120 times.
✗ Branch 3 not taken.
120 $$= NEW_PTN PT_order_expr($1, $2);
12703 }
12704 ;
12705
12706 opt_order_clause:
12707 9931990 /* empty */ { $$= NULL; }
12708 | order_clause
12709 ;
12710
12711 order_clause:
12712 ORDER_SYM BY order_list
12713 {
12714
2/4
✓ Branch 0 taken 786898 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 786899 times.
✗ Branch 3 not taken.
786898 $$= NEW_PTN PT_order($3);
12715 }
12716 ;
12717
12718 order_list:
12719 order_list ',' order_expr
12720 {
12721
1/2
✓ Branch 0 taken 379975 times.
✗ Branch 1 not taken.
379975 $1->push_back($3);
12722 379975 $$= $1;
12723 }
12724 | order_expr
12725 {
12726
1/2
✓ Branch 0 taken 788150 times.
✗ Branch 1 not taken.
1576300 $$= NEW_PTN PT_order_list();
12727
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 788150 times.
788150 if ($$ == NULL)
12728 MYSQL_YYABORT;
12729
1/2
✓ Branch 0 taken 788150 times.
✗ Branch 1 not taken.
788150 $$->push_back($1);
12730 }
12731 ;
12732
12733 opt_ordering_direction:
12734 3814071 /* empty */ { $$= ORDER_NOT_RELEVANT; }
12735 | ordering_direction
12736 ;
12737
12738 ordering_direction:
12739 5966 ASC { $$= ORDER_ASC; }
12740 157314 | DESC { $$= ORDER_DESC; }
12741 ;
12742
12743 opt_limit_clause:
12744 10373254 /* empty */ { $$= NULL; }
12745 | limit_clause
12746 ;
12747
12748 limit_clause:
12749 LIMIT limit_options
12750 {
12751
2/4
✓ Branch 0 taken 48569 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48569 times.
✗ Branch 3 not taken.
48569 $$= NEW_PTN PT_limit_clause($2);
12752 }
12753 ;
12754
12755 limit_options:
12756 limit_option
12757 {
12758 46123 $$.limit= $1;
12759 46123 $$.opt_offset= NULL;
12760 46123 $$.is_offset_first= false;
12761 }
12762 | limit_option ',' limit_option
12763 {
12764 2255 $$.limit= $3;
12765 2255 $$.opt_offset= $1;
12766 2255 $$.is_offset_first= true;
12767 }
12768 | limit_option OFFSET_SYM limit_option
12769 {
12770 191 $$.limit= $1;
12771 191 $$.opt_offset= $3;
12772 191 $$.is_offset_first= false;
12773 }
12774 ;
12775
12776 limit_option:
12777 ident
12778 {
12779
2/4
✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 60 times.
✗ Branch 3 not taken.
60 $$= NEW_PTN PTI_limit_option_ident(@$, to_lex_cstring($1));
12780 }
12781 | param_marker
12782 {
12783
2/4
✓ Branch 0 taken 73 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 73 times.
✗ Branch 3 not taken.
73 $$= NEW_PTN PTI_limit_option_param_marker(@$, $1);
12784 }
12785 | ULONGLONG_NUM
12786 {
12787
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 $$= NEW_PTN Item_uint(@$, $1.str, $1.length);
12788 }
12789 | LONG_NUM
12790 {
12791
2/4
✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
✗ Branch 3 not taken.
20 $$= NEW_PTN Item_uint(@$, $1.str, $1.length);
12792 }
12793 | NUM
12794 {
12795
2/4
✓ Branch 0 taken 52217 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 52217 times.
✗ Branch 3 not taken.
52216 $$= NEW_PTN Item_uint(@$, $1.str, $1.length);
12796 }
12797 ;
12798
12799 opt_simple_limit:
12800 406261 /* empty */ { $$= NULL; }
12801 1349 | LIMIT limit_option { $$= $2; }
12802 ;
12803
12804 ulong_num:
12805
1/2
✓ Branch 0 taken 451621 times.
✗ Branch 1 not taken.
451621 NUM { int error; $$= (ulong) my_strtoll10($1.str, nullptr, &error); }
12806 2094 | HEX_NUM { $$= (ulong) my_strtoll($1.str, (char**) 0, 16); }
12807
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 | LONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, nullptr, &error); }
12808
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 | ULONGLONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, nullptr, &error); }
12809
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 | DECIMAL_NUM { int error; $$= (ulong) my_strtoll10($1.str, nullptr, &error); }
12810 | FLOAT_NUM { int error; $$= (ulong) my_strtoll10($1.str, nullptr, &error); }
12811 ;
12812
12813 real_ulong_num:
12814
1/2
✓ Branch 0 taken 20197 times.
✗ Branch 1 not taken.
20197 NUM { int error; $$= (ulong) my_strtoll10($1.str, nullptr, &error); }
12815 | HEX_NUM { $$= (ulong) my_strtoll($1.str, (char**) 0, 16); }
12816
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 | LONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, nullptr, &error); }
12817 | ULONGLONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, nullptr, &error); }
12818 31 | dec_num_error { MYSQL_YYABORT; }
12819 ;
12820
12821 ulonglong_num:
12822
1/2
✓ Branch 0 taken 15584 times.
✗ Branch 1 not taken.
15584 NUM { int error; $$= (ulonglong) my_strtoll10($1.str, nullptr, &error); }
12823
1/2
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
12 | ULONGLONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, nullptr, &error); }
12824
1/2
✓ Branch 0 taken 11 times.
✗ Branch 1 not taken.
11 | LONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, nullptr, &error); }
12825 | DECIMAL_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, nullptr, &error); }
12826 | FLOAT_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, nullptr, &error); }
12827 ;
12828
12829 real_ulonglong_num:
12830
1/2
✓ Branch 0 taken 2939 times.
✗ Branch 1 not taken.
2939 NUM { int error; $$= (ulonglong) my_strtoll10($1.str, nullptr, &error); }
12831 4 | HEX_NUM { $$= (ulonglong) my_strtoll($1.str, (char**) 0, 16); }
12832 | ULONGLONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, nullptr, &error); }
12833
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 | LONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, nullptr, &error); }
12834 3 | dec_num_error { MYSQL_YYABORT; }
12835 ;
12836
12837 dec_num_error:
12838 dec_num
12839
1/2
✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
34 { YYTHD->syntax_error(ER_ONLY_INTEGERS_ALLOWED); }
12840 ;
12841
12842 dec_num:
12843 DECIMAL_NUM
12844 | FLOAT_NUM
12845 ;
12846
12847 select_var_list:
12848 select_var_list ',' select_var_ident
12849 {
12850 3047 $$= $1;
12851
4/8
✓ Branch 0 taken 3047 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3047 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3047 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 3047 times.
3047 if ($$ == NULL || $$->push_back($3))
12852 MYSQL_YYABORT;
12853 }
12854 | select_var_ident
12855 {
12856
2/4
✓ Branch 0 taken 109787 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 109787 times.
✗ Branch 3 not taken.
109788 $$= NEW_PTN PT_select_var_list(@$);
12857
4/8
✓ Branch 0 taken 109788 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 109789 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 109789 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 109788 times.
109787 if ($$ == NULL || $$->push_back($1))
12858 MYSQL_YYABORT;
12859 }
12860 ;
12861
12862 select_var_ident:
12863 '@' ident_or_text
12864 {
12865
2/4
✓ Branch 0 taken 40824 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 40824 times.
✗ Branch 3 not taken.
40824 $$= NEW_PTN PT_select_var($2);
12866 }
12867 | ident_or_text
12868 {
12869
2/4
✓ Branch 0 taken 72010 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 72010 times.
✗ Branch 3 not taken.
72010 $$= NEW_PTN PT_select_sp_var($1);
12870 }
12871 ;
12872
12873 into_clause:
12874 INTO into_destination
12875 {
12876 135590 $$= $2;
12877 }
12878 ;
12879
12880 into_destination:
12881 OUTFILE TEXT_STRING_filesystem
12882 opt_load_data_charset
12883 opt_field_term opt_line_term
12884 {
12885
2/4
✓ Branch 0 taken 25466 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25466 times.
✗ Branch 3 not taken.
25466 $$= NEW_PTN PT_into_destination_outfile(@$, $2, $3, $4, $5);
12886 }
12887 | DUMPFILE TEXT_STRING_filesystem
12888 {
12889
2/4
✓ Branch 0 taken 335 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 335 times.
✗ Branch 3 not taken.
335 $$= NEW_PTN PT_into_destination_dumpfile(@$, $2);
12890 }
12891 109788 | select_var_list { $$= $1; }
12892 ;
12893
12894 /*
12895 DO statement
12896 */
12897
12898 do_stmt:
12899 DO_SYM select_item_list
12900 {
12901
1/2
✓ Branch 0 taken 15064 times.
✗ Branch 1 not taken.
30128 $$= NEW_PTN PT_select_stmt(SQLCOM_DO,
12902
1/2
✓ Branch 0 taken 15064 times.
✗ Branch 1 not taken.
30128 NEW_PTN PT_query_expression(
12903
3/6
✓ Branch 0 taken 15064 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15064 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 15064 times.
✗ Branch 5 not taken.
75320 NEW_PTN PT_query_specification({}, $2)));
12904 }
12905 ;
12906
12907 /*
12908 Drop : delete tables or index or user or role
12909 */
12910
12911 drop_table_stmt:
12912 DROP opt_temporary table_or_tables if_exists table_list opt_restrict
12913 {
12914 // Note: opt_restrict ($6) is ignored!
12915 166196 LEX *lex=Lex;
12916 166196 lex->sql_command = SQLCOM_DROP_TABLE;
12917 166196 lex->drop_temporary= $2;
12918 166196 lex->drop_if_exists= $4;
12919 166196 YYPS->m_lock_type= TL_UNLOCK;
12920 166196 YYPS->m_mdl_type= MDL_EXCLUSIVE;
12921
2/2
✓ Branch 0 taken 63 times.
✓ Branch 1 taken 166133 times.
332392 if (Select->add_tables(YYTHD, $5, TL_OPTION_UPDATING,
12922
1/2
✓ Branch 0 taken 166196 times.
✗ Branch 1 not taken.
166196 YYPS->m_lock_type, YYPS->m_mdl_type))
12923 63 MYSQL_YYABORT;
12924 }
12925 ;
12926
12927 drop_index_stmt:
12928 DROP INDEX_SYM ident ON_SYM table_ident opt_index_lock_and_algorithm
12929 {
12930
1/2
✓ Branch 0 taken 2818 times.
✗ Branch 1 not taken.
5636 $$= NEW_PTN PT_drop_index_stmt(YYMEM_ROOT, $3.str, $5,
12931
1/2
✓ Branch 0 taken 2818 times.
✗ Branch 1 not taken.
2818 $6.algo.get_or_default(),
12932
2/4
✓ Branch 0 taken 2818 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2818 times.
✗ Branch 3 not taken.
5636 $6.lock.get_or_default());
12933 }
12934 ;
12935
12936 drop_database_stmt:
12937 DROP DATABASE if_exists ident
12938 {
12939 6855 LEX *lex=Lex;
12940 6855 lex->sql_command= SQLCOM_DROP_DB;
12941 6855 lex->drop_if_exists=$3;
12942 6855 lex->name= $4;
12943 }
12944 ;
12945
12946 drop_function_stmt:
12947 DROP FUNCTION_SYM if_exists ident '.' ident
12948 {
12949 1643 THD *thd= YYTHD;
12950 1643 LEX *lex= thd->lex;
12951 sp_name *spname;
12952
3/4
✓ Branch 0 taken 1643 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1642 times.
3286 if ($4.str &&
12953
3/4
✓ Branch 0 taken 1643 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1642 times.
1643 (check_and_convert_db_name(&$4, false) != Ident_name_check::OK))
12954 1 MYSQL_YYABORT;
12955
3/4
✓ Branch 0 taken 1642 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1641 times.
1642 if (sp_check_name(&$6))
12956 1 MYSQL_YYABORT;
12957
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1641 times.
1641 if (lex->sphead)
12958 {
12959 my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
12960 MYSQL_YYABORT;
12961 }
12962 1641 lex->sql_command = SQLCOM_DROP_FUNCTION;
12963 1641 lex->drop_if_exists= $3;
12964
1/2
✓ Branch 0 taken 1641 times.
✗ Branch 1 not taken.
1641 spname= new (YYMEM_ROOT) sp_name(to_lex_cstring($4), $6, true);
12965
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1641 times.
1641 if (spname == NULL)
12966 MYSQL_YYABORT;
12967
1/2
✓ Branch 0 taken 1641 times.
✗ Branch 1 not taken.
1641 spname->init_qname(thd);
12968 1641 lex->spname= spname;
12969 }
12970 | DROP FUNCTION_SYM if_exists ident
12971 {
12972 /*
12973 Unlike DROP PROCEDURE, "DROP FUNCTION ident" should work
12974 even if there is no current database. In this case it
12975 applies only to UDF.
12976 Hence we can't merge rules for "DROP FUNCTION ident.ident"
12977 and "DROP FUNCTION ident" into one "DROP FUNCTION sp_name"
12978 rule. sp_name assumes that database name should be always
12979 provided - either explicitly or implicitly.
12980 */
12981 18133 THD *thd= YYTHD;
12982 18133 LEX *lex= thd->lex;
12983 18133 LEX_STRING db= NULL_STR;
12984 sp_name *spname;
12985
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 18130 times.
18133 if (lex->sphead)
12986 {
12987
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
12988 5 MYSQL_YYABORT;
12989 }
12990
5/8
✓ Branch 0 taken 18127 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 18127 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 18127 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 18130 times.
18130 if (thd->db().str && lex->copy_db_to(&db.str, &db.length))
12991 MYSQL_YYABORT;
12992
3/4
✓ Branch 0 taken 18130 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 18128 times.
18130 if (sp_check_name(&$4))
12993 2 MYSQL_YYABORT;
12994 18128 lex->sql_command = SQLCOM_DROP_FUNCTION;
12995 18128 lex->drop_if_exists= $3;
12996
1/2
✓ Branch 0 taken 18128 times.
✗ Branch 1 not taken.
18128 spname= new (YYMEM_ROOT) sp_name(to_lex_cstring(db), $4, false);
12997
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 18128 times.
18128 if (spname == NULL)
12998 MYSQL_YYABORT;
12999
1/2
✓ Branch 0 taken 18128 times.
✗ Branch 1 not taken.
18128 spname->init_qname(thd);
13000 18128 lex->spname= spname;
13001 }
13002 ;
13003
13004 drop_resource_group_stmt:
13005 DROP RESOURCE_SYM GROUP_SYM ident opt_force
13006 {
13007
1/2
✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
20 $$= NEW_PTN PT_drop_resource_group(to_lex_cstring($4), $5);
13008 }
13009 ;
13010
13011 drop_procedure_stmt:
13012 DROP PROCEDURE_SYM if_exists sp_name
13013 {
13014 20671 LEX *lex=Lex;
13015
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 20669 times.
20671 if (lex->sphead)
13016 {
13017
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE");
13018 2 MYSQL_YYABORT;
13019 }
13020 20669 lex->sql_command = SQLCOM_DROP_PROCEDURE;
13021 20669 lex->drop_if_exists= $3;
13022 20669 lex->spname= $4;
13023 }
13024 ;
13025
13026 drop_user_stmt:
13027 DROP USER if_exists user_list
13028 {
13029 4681 LEX *lex=Lex;
13030 4681 lex->sql_command= SQLCOM_DROP_USER;
13031 4681 lex->drop_if_exists= $3;
13032 4681 lex->users_list= *$4;
13033 }
13034 ;
13035
13036 drop_view_stmt:
13037 DROP VIEW_SYM if_exists table_list opt_restrict
13038 {
13039 // Note: opt_restrict ($5) is ignored!
13040 4007 LEX *lex= Lex;
13041 4007 lex->sql_command= SQLCOM_DROP_VIEW;
13042 4007 lex->drop_if_exists= $3;
13043 4007 YYPS->m_lock_type= TL_UNLOCK;
13044 4007 YYPS->m_mdl_type= MDL_EXCLUSIVE;
13045
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 4005 times.
8014 if (Select->add_tables(YYTHD, $4, TL_OPTION_UPDATING,
13046
1/2
✓ Branch 0 taken 4007 times.
✗ Branch 1 not taken.
4007 YYPS->m_lock_type, YYPS->m_mdl_type))
13047 2 MYSQL_YYABORT;
13048 }
13049 ;
13050
13051 drop_event_stmt:
13052 DROP EVENT_SYM if_exists sp_name
13053 {
13054 520 Lex->drop_if_exists= $3;
13055 520 Lex->spname= $4;
13056 520 Lex->sql_command = SQLCOM_DROP_EVENT;
13057 }
13058 ;
13059
13060 drop_trigger_stmt:
13061 DROP TRIGGER_SYM if_exists sp_name
13062 {
13063 5180 LEX *lex= Lex;
13064 5180 lex->sql_command= SQLCOM_DROP_TRIGGER;
13065 5180 lex->drop_if_exists= $3;
13066 5180 lex->spname= $4;
13067
1/2
✓ Branch 0 taken 5180 times.
✗ Branch 1 not taken.
10360 Lex->m_sql_cmd= new (YYTHD->mem_root) Sql_cmd_drop_trigger();
13068 }
13069 ;
13070
13071 drop_tablespace_stmt:
13072 DROP TABLESPACE_SYM ident opt_drop_ts_options
13073 {
13074
2/4
✓ Branch 0 taken 932 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 932 times.
✗ Branch 3 not taken.
932 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
13075
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 932 times.
932 if (pc == NULL)
13076 MYSQL_YYABORT; /* purecov: inspected */ // OOM
13077
13078
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 928 times.
932 if ($4 != NULL)
13079 {
13080
5/10
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 4 times.
4 if (YYTHD->is_error() || contextualize_array(pc, $4))
13081 MYSQL_YYABORT; /* purecov: inspected */
13082 }
13083
13084
2/4
✓ Branch 0 taken 932 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 932 times.
✗ Branch 3 not taken.
932 auto cmd= NEW_PTN Sql_cmd_drop_tablespace{$3, pc};
13085
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 932 times.
932 if (!cmd)
13086 MYSQL_YYABORT; /* purecov: inspected */ // OOM
13087 932 Lex->m_sql_cmd= cmd;
13088 932 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
13089 }
13090
13091 drop_undo_tablespace_stmt:
13092 DROP UNDO_SYM TABLESPACE_SYM ident opt_undo_tablespace_options
13093 {
13094
2/4
✓ Branch 0 taken 355 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 355 times.
✗ Branch 3 not taken.
355 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
13095
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 355 times.
355 if (pc == NULL)
13096 MYSQL_YYABORT; // OOM
13097
13098
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 353 times.
355 if ($5 != NULL)
13099 {
13100
5/10
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
2 if (YYTHD->is_error() || contextualize_array(pc, $5))
13101 MYSQL_YYABORT;
13102 }
13103
13104 auto cmd= NEW_PTN Sql_cmd_drop_undo_tablespace{
13105
2/4
✓ Branch 0 taken 355 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 355 times.
✗ Branch 3 not taken.
355 DROP_UNDO_TABLESPACE, $4, {nullptr, 0}, pc};
13106
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 355 times.
355 if (!cmd)
13107 MYSQL_YYABORT; // OOM
13108 355 Lex->m_sql_cmd= cmd;
13109 355 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
13110 }
13111 ;
13112
13113 drop_logfile_stmt:
13114 DROP LOGFILE_SYM GROUP_SYM ident opt_drop_ts_options
13115 {
13116
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 auto pc= NEW_PTN Alter_tablespace_parse_context{YYTHD};
13117
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 if (pc == NULL)
13118 MYSQL_YYABORT; /* purecov: inspected */ // OOM
13119
13120
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
4 if ($5 != NULL)
13121 {
13122
5/10
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
2 if (YYTHD->is_error() || contextualize_array(pc, $5))
13123 MYSQL_YYABORT; /* purecov: inspected */
13124 }
13125
13126 auto cmd= NEW_PTN Sql_cmd_logfile_group{DROP_LOGFILE_GROUP,
13127
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 $4, pc};
13128
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 if (!cmd)
13129 MYSQL_YYABORT; /* purecov: inspected */ // OOM
13130 4 Lex->m_sql_cmd= cmd;
13131 4 Lex->sql_command= SQLCOM_ALTER_TABLESPACE;
13132 }
13133
13134 ;
13135
13136 drop_server_stmt:
13137 DROP SERVER_SYM if_exists ident_or_text
13138 {
13139 56 Lex->sql_command = SQLCOM_DROP_SERVER;
13140
1/2
✓ Branch 0 taken 56 times.
✗ Branch 1 not taken.
56 Lex->m_sql_cmd= NEW_PTN Sql_cmd_drop_server($4, $3);
13141 }
13142 | DROP COMPRESSION_DICTIONARY_SYM if_exists ident
13143 {
13144 87 Lex->sql_command= SQLCOM_DROP_COMPRESSION_DICTIONARY;
13145 87 Lex->drop_if_exists= $3;
13146 87 Lex->ident= $4;
13147 }
13148 ;
13149
13150 drop_srs_stmt:
13151 DROP SPATIAL_SYM REFERENCE_SYM SYSTEM_SYM if_exists real_ulonglong_num
13152 {
13153
1/2
✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
206 $$= NEW_PTN PT_drop_srs($6, $5);
13154 }
13155 ;
13156
13157 drop_role_stmt:
13158 DROP ROLE_SYM if_exists role_list
13159 {
13160
1/2
✓ Branch 0 taken 529 times.
✗ Branch 1 not taken.
529 $$= NEW_PTN PT_drop_role($3, $4);
13161 }
13162 ;
13163
13164 table_list:
13165 table_ident
13166 {
13167
2/4
✓ Branch 0 taken 208034 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 208034 times.
✗ Branch 3 not taken.
208034 $$= NEW_PTN Mem_root_array<Table_ident *>(YYMEM_ROOT);
13168
2/4
✓ Branch 0 taken 208034 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 208034 times.
208034 if ($$->push_back($1))
13169 MYSQL_YYABORT; // OOM
13170 }
13171 | table_list ',' table_ident
13172 {
13173 739536 $$= $1;
13174
4/8
✓ Branch 0 taken 739536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 739536 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 739536 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 739536 times.
739536 if ($$ == NULL || $$->push_back($3))
13175 MYSQL_YYABORT; // OOM
13176 }
13177 ;
13178
13179 table_alias_ref_list:
13180 table_ident_opt_wild
13181 {
13182 1142 $$.init(YYMEM_ROOT);
13183
2/4
✓ Branch 0 taken 1142 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1142 times.
1142 if ($$.push_back($1))
13184 MYSQL_YYABORT; // OOM
13185 }
13186 | table_alias_ref_list ',' table_ident_opt_wild
13187 {
13188 719 $$= $1;
13189
2/4
✓ Branch 0 taken 719 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 719 times.
719 if ($$.push_back($3))
13190 MYSQL_YYABORT; // OOM
13191 }
13192 ;
13193
13194 if_exists:
13195 172432 /* empty */ { $$= 0; }
13196 65727 | IF EXISTS { $$= 1; }
13197 ;
13198
13199 opt_ignore_unknown_user:
13200 3617 /* empty */ { $$= 0; }
13201 21 | IGNORE_SYM UNKNOWN_SYM USER { $$= 1; }
13202 ;
13203
13204 opt_temporary:
13205 762296 /* empty */ { $$= false; }
13206 83013 | TEMPORARY { $$= true; }
13207 ;
13208
13209 opt_drop_ts_options:
13210 930 /* empty*/ { $$= NULL; }
13211 | drop_ts_option_list
13212 ;
13213
13214 drop_ts_option_list:
13215 drop_ts_option
13216 {
13217
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
6 $$= NEW_PTN Mem_root_array<PT_alter_tablespace_option_base*>(YYMEM_ROOT);
13218
4/8
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 6 times.
6 if ($$ == NULL || $$->push_back($1))
13219 MYSQL_YYABORT; /* purecov: inspected */ // OOM
13220 }
13221 | drop_ts_option_list opt_comma drop_ts_option
13222 {
13223 $$= $1;
13224 if ($$->push_back($3))
13225 MYSQL_YYABORT; /* purecov: inspected */ // OOM
13226 }
13227 ;
13228
13229 drop_ts_option:
13230 ts_option_engine
13231 | ts_option_wait
13232 ;
13233 /*
13234 ** Insert : add new data to table
13235 */
13236
13237 insert_stmt:
13238 INSERT_SYM /* #1 */
13239 insert_lock_option /* #2 */
13240 opt_ignore /* #3 */
13241 opt_INTO /* #4 */
13242 table_ident /* #5 */
13243 opt_use_partition /* #6 */
13244 insert_from_constructor /* #7 */
13245 opt_values_reference /* #8 */
13246 opt_insert_update_list /* #9 */
13247 {
13248
2/6
✓ Branch 0 taken 6742813 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6742813 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
6742758 DBUG_EXECUTE_IF("bug29614521_simulate_oom",
13249 DBUG_SET("+d,simulate_out_of_memory"););
13250
1/2
✓ Branch 0 taken 6743144 times.
✗ Branch 1 not taken.
13486002 $$= NEW_PTN PT_insert(false, $1, $2, $3, $5, $6,
13251 6743144 $7.column_list, $7.row_value_list,
13252 NULL,
13253 6743144 $8.table_alias, $8.column_list,
13254
1/2
✓ Branch 0 taken 6742858 times.
✗ Branch 1 not taken.
13485957 $9.column_list, $9.value_list);
13255
2/6
✓ Branch 0 taken 6743217 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6743217 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
6742858 DBUG_EXECUTE_IF("bug29614521_simulate_oom",
13256 DBUG_SET("-d,bug29614521_simulate_oom"););
13257 }
13258 | INSERT_SYM /* #1 */
13259 insert_lock_option /* #2 */
13260 opt_ignore /* #3 */
13261 opt_INTO /* #4 */
13262 table_ident /* #5 */
13263 opt_use_partition /* #6 */
13264 SET_SYM /* #7 */
13265 update_list /* #8 */
13266 opt_values_reference /* #9 */
13267 opt_insert_update_list /* #10 */
13268 {
13269
2/4
✓ Branch 0 taken 9789 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9789 times.
✗ Branch 3 not taken.
9789 PT_insert_values_list *one_row= NEW_PTN PT_insert_values_list(YYMEM_ROOT);
13270
4/8
✓ Branch 0 taken 9789 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9790 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 9790 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 9790 times.
9789 if (one_row == NULL || one_row->push_back(&$8.value_list->value))
13271 MYSQL_YYABORT; // OOM
13272
1/2
✓ Branch 0 taken 9790 times.
✗ Branch 1 not taken.
19579 $$= NEW_PTN PT_insert(false, $1, $2, $3, $5, $6,
13273 9790 $8.column_list, one_row,
13274 NULL,
13275 9790 $9.table_alias, $9.column_list,
13276
1/2
✓ Branch 0 taken 9789 times.
✗ Branch 1 not taken.
19580 $10.column_list, $10.value_list);
13277 }
13278 | INSERT_SYM /* #1 */
13279 insert_lock_option /* #2 */
13280 opt_ignore /* #3 */
13281 opt_INTO /* #4 */
13282 table_ident /* #5 */
13283 opt_use_partition /* #6 */
13284 insert_query_expression /* #7 */
13285 opt_insert_update_list /* #8 */
13286 {
13287
1/2
✓ Branch 0 taken 32776 times.
✗ Branch 1 not taken.
65552 $$= NEW_PTN PT_insert(false, $1, $2, $3, $5, $6,
13288 32776 $7.column_list, NULL,
13289 32776 $7.insert_query_expression,
13290 NULL_CSTR, NULL,
13291
1/2
✓ Branch 0 taken 32776 times.
✗ Branch 1 not taken.
65552 $8.column_list, $8.value_list);
13292 }
13293 ;
13294
13295 replace_stmt:
13296 REPLACE_SYM /* #1 */
13297 replace_lock_option /* #2 */
13298 opt_INTO /* #3 */
13299 table_ident /* #4 */
13300 opt_use_partition /* #5 */
13301 insert_from_constructor /* #6 */
13302 {
13303
1/2
✓ Branch 0 taken 2272018 times.
✗ Branch 1 not taken.
4544036 $$= NEW_PTN PT_insert(true, $1, $2, false, $4, $5,
13304 $6.column_list, $6.row_value_list,
13305 NULL,
13306 NULL_CSTR, NULL,
13307
1/2
✓ Branch 0 taken 2272018 times.
✗ Branch 1 not taken.
4544036 NULL, NULL);
13308 }
13309 | REPLACE_SYM /* #1 */
13310 replace_lock_option /* #2 */
13311 opt_INTO /* #3 */
13312 table_ident /* #4 */
13313 opt_use_partition /* #5 */
13314 SET_SYM /* #6 */
13315 update_list /* #7 */
13316 {
13317
2/4
✓ Branch 0 taken 208 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 208 times.
✗ Branch 3 not taken.
208 PT_insert_values_list *one_row= NEW_PTN PT_insert_values_list(YYMEM_ROOT);
13318
4/8
✓ Branch 0 taken 208 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 208 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 208 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 208 times.
208 if (one_row == NULL || one_row->push_back(&$7.value_list->value))
13319 MYSQL_YYABORT; // OOM
13320
1/2
✓ Branch 0 taken 208 times.
✗ Branch 1 not taken.
416 $$= NEW_PTN PT_insert(true, $1, $2, false, $4, $5,
13321 $7.column_list, one_row,
13322 NULL,
13323 NULL_CSTR, NULL,
13324
1/2
✓ Branch 0 taken 208 times.
✗ Branch 1 not taken.
416 NULL, NULL);
13325 }
13326 | REPLACE_SYM /* #1 */
13327 replace_lock_option /* #2 */
13328 opt_INTO /* #3 */
13329 table_ident /* #4 */
13330 opt_use_partition /* #5 */
13331 insert_query_expression /* #6 */
13332 {
13333
1/2
✓ Branch 0 taken 491 times.
✗ Branch 1 not taken.
982 $$= NEW_PTN PT_insert(true, $1, $2, false, $4, $5,
13334 $6.column_list, NULL,
13335 $6.insert_query_expression,
13336 NULL_CSTR, NULL,
13337
1/2
✓ Branch 0 taken 491 times.
✗ Branch 1 not taken.
982 NULL, NULL);
13338 }
13339 ;
13340
13341 insert_lock_option:
13342 6785476 /* empty */ { $$= TL_WRITE_CONCURRENT_DEFAULT; }
13343 14 | LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; }
13344 | DELAYED_SYM
13345 {
13346 21 $$= TL_WRITE_CONCURRENT_DEFAULT;
13347
13348
2/4
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
21 push_warning_printf(YYTHD, Sql_condition::SL_WARNING,
13349 ER_WARN_LEGACY_SYNTAX_CONVERTED,
13350 ER_THD(YYTHD, ER_WARN_LEGACY_SYNTAX_CONVERTED),
13351 "INSERT DELAYED", "INSERT");
13352 }
13353 3 | HIGH_PRIORITY { $$= TL_WRITE; }
13354 ;
13355
13356 replace_lock_option:
13357 2272720 opt_low_priority { $$= $1; }
13358 | DELAYED_SYM
13359 {
13360 4 $$= TL_WRITE_DEFAULT;
13361
13362
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 push_warning_printf(YYTHD, Sql_condition::SL_WARNING,
13363 ER_WARN_LEGACY_SYNTAX_CONVERTED,
13364 ER_THD(YYTHD, ER_WARN_LEGACY_SYNTAX_CONVERTED),
13365 "REPLACE DELAYED", "REPLACE");
13366 }
13367 ;
13368
13369 opt_INTO:
13370 /* empty */
13371 | INTO
13372 ;
13373
13374 insert_from_constructor:
13375 insert_values
13376 {
13377
2/4
✓ Branch 0 taken 3625404 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3625488 times.
✗ Branch 3 not taken.
3625257 $$.column_list= NEW_PTN PT_item_list;
13378 3625488 $$.row_value_list= $1;
13379 }
13380 | '(' ')' insert_values
13381 {
13382
2/4
✓ Branch 0 taken 877 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 877 times.
✗ Branch 3 not taken.
877 $$.column_list= NEW_PTN PT_item_list;
13383 877 $$.row_value_list= $3;
13384 }
13385 | '(' fields ')' insert_values
13386 {
13387 5388649 $$.column_list= $2;
13388 5388649 $$.row_value_list= $4;
13389 }
13390 ;
13391
13392 insert_query_expression:
13393 query_expression_or_parens
13394 {
13395
2/4
✓ Branch 0 taken 23296 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 23296 times.
✗ Branch 3 not taken.
23296 $$.column_list= NEW_PTN PT_item_list;
13396 23296 $$.insert_query_expression= $1;
13397 }
13398 | '(' ')' query_expression_or_parens
13399 {
13400
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 $$.column_list= NEW_PTN PT_item_list;
13401 1 $$.insert_query_expression= $3;
13402 }
13403 | '(' fields ')' query_expression_or_parens
13404 {
13405 9970 $$.column_list= $2;
13406 9970 $$.insert_query_expression= $4;
13407 }
13408 ;
13409
13410 fields:
13411 fields ',' insert_ident
13412 {
13413
2/4
✓ Branch 0 taken 19037716 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 19037716 times.
19037566 if ($$->push_back($3))
13414 MYSQL_YYABORT;
13415 19037716 $$= $1;
13416 }
13417 | insert_ident
13418 {
13419
2/4
✓ Branch 0 taken 5398693 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5398709 times.
✗ Branch 3 not taken.
5398619 $$= NEW_PTN PT_item_list;
13420
4/8
✓ Branch 0 taken 5398740 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5398704 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5398709 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5398673 times.
5398709 if ($$ == NULL || $$->push_back($1))
13421 MYSQL_YYABORT;
13422 }
13423 ;
13424
13425 insert_values:
13426 value_or_values values_list
13427 {
13428 9015247 $$= $2;
13429 }
13430 ;
13431
13432 query_expression_or_parens:
13433 118223 query_expression { $$ = $1; }
13434 | query_expression locking_clause_list
13435 {
13436
2/4
✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
24 $$ = NEW_PTN PT_locking($1, $2);
13437 }
13438 2209 | query_expression_parens { $$ = $1; }
13439 ;
13440
13441 value_or_values:
13442 VALUE_SYM
13443 | VALUES
13444 ;
13445
13446 values_list:
13447 values_list ',' row_value
13448 {
13449
2/4
✓ Branch 0 taken 4460865 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4460865 times.
4460865 if ($$->push_back(&$3->value))
13450 MYSQL_YYABORT;
13451 }
13452 | row_value
13453 {
13454
2/4
✓ Branch 0 taken 9014838 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9014853 times.
✗ Branch 3 not taken.
9015028 $$= NEW_PTN PT_insert_values_list(YYMEM_ROOT);
13455
4/8
✓ Branch 0 taken 9014958 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9015182 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 9015222 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 9015077 times.
9014853 if ($$ == NULL || $$->push_back(&$1->value))
13456 MYSQL_YYABORT;
13457 }
13458 ;
13459
13460
13461 values_row_list:
13462 values_row_list ',' row_value_explicit
13463 {
13464
2/4
✓ Branch 0 taken 121 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 121 times.
121 if ($$->push_back(&$3->value))
13465 MYSQL_YYABORT;
13466 }
13467 | row_value_explicit
13468 {
13469
2/4
✓ Branch 0 taken 169 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 169 times.
✗ Branch 3 not taken.
169 $$= NEW_PTN PT_insert_values_list(YYMEM_ROOT);
13470
4/8
✓ Branch 0 taken 169 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 169 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 169 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 169 times.
169 if ($$ == nullptr || $$->push_back(&$1->value))
13471 MYSQL_YYABORT;
13472 }
13473 ;
13474
13475 equal:
13476 EQ
13477 | SET_VAR
13478 ;
13479
13480 opt_equal:
13481 /* empty */
13482 | equal
13483 ;
13484
13485 row_value:
13486 13475696 '(' opt_values ')' { $$= $2; }
13487 ;
13488
13489 row_value_explicit:
13490 290 ROW_SYM '(' opt_values ')' { $$= $3; }
13491 ;
13492
13493 opt_values:
13494 /* empty */
13495 {
13496
2/4
✓ Branch 0 taken 1073 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1073 times.
✗ Branch 3 not taken.
1073 $$= NEW_PTN PT_item_list;
13497
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1073 times.
1073 if ($$ == NULL)
13498 MYSQL_YYABORT;
13499 }
13500 | values
13501 ;
13502
13503 values:
13504 values ',' expr_or_default
13505 {
13506
2/4
✓ Branch 0 taken 32558687 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 32558687 times.
32558531 if ($1->push_back($3))
13507 MYSQL_YYABORT;
13508 32558687 $$= $1;
13509 }
13510 | expr_or_default
13511 {
13512
2/4
✓ Branch 0 taken 13475098 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13475203 times.
✗ Branch 3 not taken.
13475084 $$= NEW_PTN PT_item_list;
13513
4/8
✓ Branch 0 taken 13475297 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13475405 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 13475422 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 13475311 times.
13475203 if ($$ == NULL || $$->push_back($1))
13514 MYSQL_YYABORT;
13515 }
13516 ;
13517
13518 expr_or_default:
13519 expr
13520 | DEFAULT_SYM
13521 {
13522
2/4
✓ Branch 0 taken 5481 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5481 times.
✗ Branch 3 not taken.
5481 $$= NEW_PTN Item_default_value(@$);
13523 }
13524 ;
13525
13526 opt_values_reference:
13527 /* empty */
13528 {
13529 6753240 $$.table_alias = NULL_CSTR;
13530 6753240 $$.column_list = NULL;
13531 }
13532 | AS ident opt_derived_column_list
13533 {
13534 49 $$.table_alias = to_lex_cstring($2);
13535 /* The column list object is short-lived, requiring duplication. */
13536
1/2
✓ Branch 0 taken 49 times.
✗ Branch 1 not taken.
49 void *column_list_raw_mem= YYTHD->memdup(&($3), sizeof($3));
13537
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 49 times.
49 if (!column_list_raw_mem)
13538 MYSQL_YYABORT; // OOM
13539 49 $$.column_list =
13540 static_cast<Create_col_name_list *>(column_list_raw_mem);
13541 }
13542 ;
13543
13544 opt_insert_update_list:
13545 /* empty */
13546 {
13547 6784074 $$.value_list= NULL;
13548 6784074 $$.column_list= NULL;
13549 }
13550 | ON_SYM DUPLICATE_SYM KEY_SYM UPDATE_SYM update_list
13551 {
13552 2155 $$= $5;
13553 }
13554 ;
13555
13556 /* Update rows in a table */
13557
13558 update_stmt:
13559 opt_with_clause
13560 UPDATE_SYM /* #1 */
13561 opt_low_priority /* #2 */
13562 opt_ignore /* #3 */
13563 table_reference_list /* #4 */
13564 SET_SYM /* #5 */
13565 update_list /* #6 */
13566 opt_where_clause /* #7 */
13567 opt_order_clause /* #8 */
13568 opt_simple_limit /* #9 */
13569 {
13570
1/2
✓ Branch 0 taken 360824 times.
✗ Branch 1 not taken.
721649 $$= NEW_PTN PT_update($1, $2, $3, $4, $5, $7.column_list, $7.value_list,
13571 721648 $8, $9, $10);
13572 }
13573 ;
13574
13575 opt_with_clause:
13576 408878 /* empty */ { $$= NULL; }
13577 74 | with_clause { $$= $1; }
13578 ;
13579
13580 update_list:
13581 update_list ',' update_elem
13582 {
13583 42982 $$= $1;
13584
3/6
✓ Branch 0 taken 42982 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 42982 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 42982 times.
85964 if ($$.column_list->push_back($3.column) ||
13585
2/4
✓ Branch 0 taken 42982 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 42982 times.
42982 $$.value_list->push_back($3.value))
13586 MYSQL_YYABORT; // OOM
13587 }
13588 | update_elem
13589 {
13590
2/4
✓ Branch 0 taken 372980 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 372985 times.
✗ Branch 3 not taken.
372999 $$.column_list= NEW_PTN PT_item_list;
13591
2/4
✓ Branch 0 taken 372991 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 372987 times.
✗ Branch 3 not taken.
372985 $$.value_list= NEW_PTN PT_item_list;
13592
1/2
✓ Branch 0 taken 372993 times.
✗ Branch 1 not taken.
372989 if ($$.column_list == NULL || $$.value_list == NULL ||
13593
4/8
✓ Branch 0 taken 372989 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 372989 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 372989 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 372982 times.
1118964 $$.column_list->push_back($1.column) ||
13594
2/4
✓ Branch 0 taken 372988 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 372988 times.
372989 $$.value_list->push_back($1.value))
13595 MYSQL_YYABORT; // OOM
13596 }
13597 ;
13598
13599 update_elem:
13600 simple_ident_nospvar equal expr_or_default
13601 {
13602 415963 $$.column= $1;
13603 415963 $$.value= $3;
13604 }
13605 ;
13606
13607 opt_low_priority:
13608 2633549 /* empty */ { $$= TL_WRITE_DEFAULT; }
13609 13 | LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; }
13610 ;
13611
13612 /* Delete rows from a table */
13613
13614 delete_stmt:
13615 opt_with_clause
13616 DELETE_SYM
13617 opt_delete_options
13618 FROM
13619 table_ident
13620 opt_table_alias
13621 opt_use_partition
13622 opt_where_clause
13623 opt_order_clause
13624 opt_simple_limit
13625 {
13626
2/4
✓ Branch 0 taken 46782 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 46784 times.
✗ Branch 3 not taken.
46783 $$= NEW_PTN PT_delete($1, $2, $3, $5, $6, $7, $8, $9, $10);
13627 }
13628 | opt_with_clause
13629 DELETE_SYM
13630 opt_delete_options
13631 table_alias_ref_list
13632 FROM
13633 table_reference_list
13634 opt_where_clause
13635 {
13636
2/4
✓ Branch 0 taken 642 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 642 times.
✗ Branch 3 not taken.
642 $$= NEW_PTN PT_delete($1, $2, $3, $4, $6, $7);
13637 }
13638 | opt_with_clause
13639 DELETE_SYM
13640 opt_delete_options
13641 FROM
13642 table_alias_ref_list
13643 USING
13644 table_reference_list
13645 opt_where_clause
13646 {
13647
2/4
✓ Branch 0 taken 209 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 209 times.
✗ Branch 3 not taken.
209 $$= NEW_PTN PT_delete($1, $2, $3, $5, $7, $8);
13648 }
13649 ;
13650
13651 opt_wild:
13652 /* empty */
13653 | '.' '*'
13654 ;
13655
13656 opt_delete_options:
13657 47642 /* empty */ { $$= 0; }
13658 300 | opt_delete_option opt_delete_options { $$= $1 | $2; }
13659 ;
13660
13661 opt_delete_option:
13662 121 QUICK { $$= DELETE_QUICK; }
13663 20 | LOW_PRIORITY { $$= DELETE_LOW_PRIORITY; }
13664 159 | IGNORE_SYM { $$= DELETE_IGNORE; }
13665 ;
13666
13667 truncate_stmt:
13668 TRUNCATE_SYM opt_table table_ident
13669 {
13670
2/4
✓ Branch 0 taken 62754 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 62754 times.
✗ Branch 3 not taken.
62754 $$= NEW_PTN PT_truncate_table_stmt($3);
13671 }
13672 ;
13673
13674 opt_table:
13675 /* empty */
13676 | TABLE_SYM
13677 ;
13678
13679 opt_profile_defs:
13680 8 /* empty */ { $$ = 0; }
13681 | profile_defs
13682 ;
13683
13684 profile_defs:
13685 profile_def
13686 1 | profile_defs ',' profile_def { $$ = $1 | $3; }
13687 ;
13688
13689 profile_def:
13690 6 CPU_SYM { $$ = PROFILE_CPU; }
13691 2 | MEMORY_SYM { $$ = PROFILE_MEMORY; }
13692 2 | BLOCK_SYM IO_SYM { $$ = PROFILE_BLOCK_IO; }
13693 1 | CONTEXT_SYM SWITCHES_SYM { $$ = PROFILE_CONTEXT; }
13694 1 | PAGE_SYM FAULTS_SYM { $$ = PROFILE_PAGE_FAULTS; }
13695 3 | IPC_SYM { $$ = PROFILE_IPC; }
13696 1 | SWAPS_SYM { $$ = PROFILE_SWAPS; }
13697 1 | SOURCE_SYM { $$ = PROFILE_SOURCE; }
13698 5 | ALL { $$ = PROFILE_ALL; }
13699 ;
13700
13701 opt_for_query:
13702 19 /* empty */ { $$ = 0; }
13703 | FOR_SYM QUERY_SYM NUM
13704 {
13705 int error;
13706
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 $$ = static_cast<my_thread_id>(my_strtoll10($3.str, NULL, &error));
13707
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
10 if (error != 0)
13708 MYSQL_YYABORT;
13709 }
13710 ;
13711
13712 /* SHOW statements */
13713
13714 show_databases_stmt:
13715 SHOW DATABASES opt_wild_or_where
13716 {
13717
1/2
✓ Branch 0 taken 476 times.
✗ Branch 1 not taken.
476 $$ = NEW_PTN PT_show_databases(@$, $3.wild, $3.where);
13718 }
13719
13720 show_tables_stmt:
13721 SHOW opt_show_cmd_type TABLES opt_db opt_wild_or_where
13722 {
13723
1/2
✓ Branch 0 taken 26779 times.
✗ Branch 1 not taken.
26779 $$ = NEW_PTN PT_show_tables(@$, $2, $4, $5.wild, $5.where);
13724 }
13725 ;
13726
13727 show_triggers_stmt:
13728 SHOW opt_full TRIGGERS_SYM opt_db opt_wild_or_where
13729 {
13730
1/2
✓ Branch 0 taken 3432 times.
✗ Branch 1 not taken.
3432 $$ = NEW_PTN PT_show_triggers(@$, $2, $4, $5.wild, $5.where);
13731 }
13732 ;
13733
13734 show_events_stmt:
13735 SHOW EVENTS_SYM opt_db opt_wild_or_where
13736 {
13737
1/2
✓ Branch 0 taken 473 times.
✗ Branch 1 not taken.
473 $$ = NEW_PTN PT_show_events(@$, $3, $4.wild, $4.where);
13738 }
13739 ;
13740
13741 show_table_status_stmt:
13742 SHOW TABLE_SYM STATUS_SYM opt_db opt_wild_or_where
13743 {
13744
1/2
✓ Branch 0 taken 2822 times.
✗ Branch 1 not taken.
2822 $$ = NEW_PTN PT_show_table_status(@$, $4, $5.wild, $5.where);
13745 }
13746 ;
13747
13748 show_open_tables_stmt:
13749 SHOW OPEN_SYM TABLES opt_db opt_wild_or_where
13750 {
13751
1/2
✓ Branch 0 taken 99 times.
✗ Branch 1 not taken.
99 $$ = NEW_PTN PT_show_open_tables(@$, $4, $5.wild, $5.where);
13752 }
13753 ;
13754
13755 show_plugins_stmt:
13756 SHOW PLUGINS_SYM
13757 {
13758
1/2
✓ Branch 0 taken 11 times.
✗ Branch 1 not taken.
11 $$ = NEW_PTN PT_show_plugins(@$);
13759 }
13760 ;
13761
13762 show_engine_logs_stmt:
13763 SHOW ENGINE_SYM engine_or_all LOGS_SYM
13764 {
13765
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 $$ = NEW_PTN PT_show_engine_logs(@$, $3);
13766 }
13767 ;
13768
13769 show_engine_mutex_stmt:
13770 SHOW ENGINE_SYM engine_or_all MUTEX_SYM
13771 {
13772
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 $$ = NEW_PTN PT_show_engine_mutex(@$, $3);
13773 }
13774 ;
13775
13776 show_engine_status_stmt:
13777 SHOW ENGINE_SYM engine_or_all STATUS_SYM
13778 {
13779
1/2
✓ Branch 0 taken 105 times.
✗ Branch 1 not taken.
105 $$ = NEW_PTN PT_show_engine_status(@$, $3);
13780 }
13781 ;
13782
13783 show_columns_stmt:
13784 SHOW /* 1 */
13785 opt_show_cmd_type /* 2 */
13786 COLUMNS /* 3 */
13787 from_or_in /* 4 */
13788 table_ident /* 5 */
13789 opt_db /* 6 */
13790 opt_wild_or_where /* 7 */
13791 {
13792 // TODO: error if table_ident is <db>.<table> and opt_db is set.
13793
2/2
✓ Branch 0 taken 2536 times.
✓ Branch 1 taken 3658 times.
6194 if ($6)
13794 2536 $5->change_db($6);
13795
13796
1/2
✓ Branch 0 taken 6194 times.
✗ Branch 1 not taken.
6194 $$ = NEW_PTN PT_show_fields(@$, $2, $5, $7.wild, $7.where);
13797 }
13798 ;
13799
13800 show_binary_logs_stmt:
13801 SHOW master_or_binary LOGS_SYM
13802 {
13803
1/2
✓ Branch 0 taken 316 times.
✗ Branch 1 not taken.
316 $$ = NEW_PTN PT_show_binlogs(@$);
13804 }
13805 ;
13806
13807 show_replicas_stmt:
13808 SHOW SLAVE HOSTS_SYM
13809 {
13810 130 Lex->set_replication_deprecated_syntax_used();
13811
1/2
✓ Branch 0 taken 130 times.
✗ Branch 1 not taken.
130 push_deprecated_warn(YYTHD, "SHOW SLAVE HOSTS", "SHOW REPLICAS");
13812
13813
1/2
✓ Branch 0 taken 130 times.
✗ Branch 1 not taken.
130 $$ = NEW_PTN PT_show_replicas(@$);
13814 }
13815 | SHOW REPLICAS_SYM
13816 {
13817
1/2
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
8 $$ = NEW_PTN PT_show_replicas(@$);
13818 }
13819 ;
13820
13821 show_binlog_events_stmt:
13822 SHOW BINLOG_SYM EVENTS_SYM opt_binlog_in binlog_from opt_limit_clause
13823 {
13824
1/2
✓ Branch 0 taken 16846 times.
✗ Branch 1 not taken.
16846 $$ = NEW_PTN PT_show_binlog_events(@$, $4, $6);
13825 }
13826 ;
13827
13828 show_relaylog_events_stmt:
13829 SHOW RELAYLOG_SYM EVENTS_SYM opt_binlog_in binlog_from opt_limit_clause
13830 opt_channel
13831 {
13832
1/2
✓ Branch 0 taken 1260 times.
✗ Branch 1 not taken.
1260 $$ = NEW_PTN PT_show_relaylog_events(@$, $4, $6, $7);
13833 }
13834 ;
13835
13836 show_keys_stmt:
13837 SHOW /* #1 */
13838 opt_extended /* #2 */
13839 keys_or_index /* #3 */
13840 from_or_in /* #4 */
13841 table_ident /* #5 */
13842 opt_db /* #6 */
13843 opt_where_clause /* #7 */
13844 {
13845 // TODO: error if table_ident is <db>.<table> and opt_db is set.
13846
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1225 times.
1227 if ($6)
13847 2 $5->change_db($6);
13848
13849
1/2
✓ Branch 0 taken 1227 times.
✗ Branch 1 not taken.
1227 $$ = NEW_PTN PT_show_keys(@$, $2, $5, $7);
13850 }
13851 ;
13852
13853 show_engines_stmt:
13854 SHOW opt_storage ENGINES_SYM
13855 {
13856
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 $$ = NEW_PTN PT_show_engines(@$);
13857 }
13858 ;
13859
13860 show_count_warnings_stmt:
13861 SHOW COUNT_SYM '(' '*' ')' WARNINGS
13862 {
13863
1/2
✓ Branch 0 taken 6067 times.
✗ Branch 1 not taken.
6067 $$ = NEW_PTN PT_show_count_warnings(@$);
13864 }
13865 ;
13866
13867 show_count_errors_stmt:
13868 SHOW COUNT_SYM '(' '*' ')' ERRORS
13869 {
13870
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 $$ = NEW_PTN PT_show_count_errors(@$);
13871 }
13872 ;
13873
13874 show_warnings_stmt:
13875 SHOW WARNINGS opt_limit_clause
13876 {
13877
1/2
✓ Branch 0 taken 91663 times.
✗ Branch 1 not taken.
91662 $$ = NEW_PTN PT_show_warnings(@$, $3);
13878 }
13879 ;
13880
13881 show_errors_stmt:
13882 SHOW ERRORS opt_limit_clause
13883 {
13884
1/2
✓ Branch 0 taken 97 times.
✗ Branch 1 not taken.
97 $$ = NEW_PTN PT_show_errors(@$, $3);
13885 }
13886 ;
13887
13888 show_profiles_stmt:
13889 SHOW PROFILES_SYM
13890 {
13891
2/4
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
15 push_warning_printf(YYTHD, Sql_condition::SL_WARNING,
13892 ER_WARN_DEPRECATED_SYNTAX,
13893 ER_THD(YYTHD, ER_WARN_DEPRECATED_SYNTAX),
13894 "SHOW PROFILES", "Performance Schema");
13895
1/2
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
15 $$ = NEW_PTN PT_show_profiles(@$);
13896 }
13897 ;
13898
13899 show_profile_stmt:
13900 SHOW PROFILE_SYM opt_profile_defs opt_for_query opt_limit_clause
13901 {
13902
1/2
✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
29 $$ = NEW_PTN PT_show_profile(@$, $3, $4, $5);
13903 }
13904 ;
13905
13906 show_status_stmt:
13907 SHOW opt_var_type STATUS_SYM opt_wild_or_where
13908 {
13909
1/2
✓ Branch 0 taken 84341 times.
✗ Branch 1 not taken.
84339 $$ = NEW_PTN PT_show_status(@$, $2, $4.wild, $4.where);
13910 }
13911 ;
13912
13913 show_processlist_stmt:
13914 SHOW opt_full PROCESSLIST_SYM
13915 {
13916
1/2
✓ Branch 0 taken 960 times.
✗ Branch 1 not taken.
960 $$ = NEW_PTN PT_show_processlist(@$, $2);
13917 }
13918 ;
13919
13920 show_variables_stmt:
13921 SHOW opt_var_type VARIABLES opt_wild_or_where
13922 {
13923
1/2
✓ Branch 0 taken 52494 times.
✗ Branch 1 not taken.
52494 $$ = NEW_PTN PT_show_variables(@$, $2, $4.wild, $4.where);
13924 }
13925 ;
13926
13927 show_character_set_stmt:
13928 SHOW character_set opt_wild_or_where
13929 {
13930
1/2
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
21 $$ = NEW_PTN PT_show_charsets(@$, $3.wild, $3.where);
13931 }
13932 ;
13933
13934 show_collation_stmt:
13935 SHOW COLLATION_SYM opt_wild_or_where
13936 {
13937
1/2
✓ Branch 0 taken 55 times.
✗ Branch 1 not taken.
55 $$ = NEW_PTN PT_show_collations(@$, $3.wild, $3.where);
13938 }
13939 ;
13940
13941 show_privileges_stmt:
13942 SHOW PRIVILEGES
13943 {
13944
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 $$ = NEW_PTN PT_show_privileges(@$);
13945 }
13946 ;
13947
13948 show_grants_stmt:
13949 SHOW GRANTS
13950 {
13951
1/2
✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
423 $$ = NEW_PTN PT_show_grants(@$, nullptr, nullptr, false);
13952 }
13953 | SHOW GRANTS FOR_SYM user
13954 {
13955
1/2
✓ Branch 0 taken 2406 times.
✗ Branch 1 not taken.
2406 $$ = NEW_PTN PT_show_grants(@$, $4, nullptr, false);
13956 }
13957 | SHOW GRANTS FOR_SYM user USING user_list
13958 {
13959
1/2
✓ Branch 0 taken 112 times.
✗ Branch 1 not taken.
112 $$ = NEW_PTN PT_show_grants(@$, $4, $6, false);
13960 }
13961 | SHOW EFFECTIVE_SYM GRANTS
13962 {
13963
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 $$ = NEW_PTN PT_show_grants(@$, nullptr, nullptr, true);
13964 }
13965 | SHOW EFFECTIVE_SYM GRANTS FOR_SYM user
13966 {
13967
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $$ = NEW_PTN PT_show_grants(@$, $5, nullptr, true);
13968 }
13969 | SHOW EFFECTIVE_SYM GRANTS FOR_SYM user USING user_list
13970 {
13971 $$ = NEW_PTN PT_show_grants(@$, $5, $7, true);
13972 }
13973 ;
13974
13975 show_create_database_stmt:
13976 SHOW CREATE DATABASE opt_if_not_exists ident
13977 {
13978
1/2
✓ Branch 0 taken 2067 times.
✗ Branch 1 not taken.
2067 $$ = NEW_PTN PT_show_create_database(@$, $4, $5);
13979 }
13980 ;
13981
13982 show_create_table_stmt:
13983 SHOW CREATE TABLE_SYM table_ident
13984 {
13985
1/2
✓ Branch 0 taken 33398 times.
✗ Branch 1 not taken.
33398 $$ = NEW_PTN PT_show_create_table(@$, $4);
13986 }
13987 ;
13988
13989 show_create_view_stmt:
13990 SHOW CREATE VIEW_SYM table_ident
13991 {
13992
1/2
✓ Branch 0 taken 973 times.
✗ Branch 1 not taken.
973 $$ = NEW_PTN PT_show_create_view(@$, $4);
13993 }
13994 ;
13995
13996 show_master_status_stmt:
13997 SHOW MASTER_SYM STATUS_SYM
13998 {
13999
1/2
✓ Branch 0 taken 105926 times.
✗ Branch 1 not taken.
105926 $$ = NEW_PTN PT_show_master_status(@$);
14000 }
14001 ;
14002
14003 show_replica_status_stmt:
14004 SHOW replica STATUS_SYM opt_channel
14005 {
14006
2/2
✓ Branch 0 taken 159679 times.
✓ Branch 1 taken 32002 times.
191681 if (Lex->is_replication_deprecated_syntax_used())
14007
1/2
✓ Branch 0 taken 159679 times.
✗ Branch 1 not taken.
159679 push_deprecated_warn(YYTHD, "SHOW SLAVE STATUS", "SHOW REPLICA STATUS");
14008
1/2
✓ Branch 0 taken 191681 times.
✗ Branch 1 not taken.
191681 $$ = NEW_PTN PT_show_replica_status(@$, $4);
14009 }
14010 ;
14011 show_stats_stmt:
14012 SHOW CLIENT_STATS_SYM opt_wild_or_where
14013 {
14014
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $$ = NEW_PTN PT_show_client_stats(@$, $3.wild, $3.where);
14015 }
14016 | SHOW USER_STATS_SYM opt_wild_or_where
14017 {
14018
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $$ = NEW_PTN PT_show_user_stats(@$, $3.wild, $3.where);
14019 }
14020 | SHOW THREAD_STATS_SYM opt_wild_or_where
14021 {
14022
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $$ = NEW_PTN PT_show_thread_stats(@$, $3.wild, $3.where);
14023 }
14024 | SHOW TABLE_STATS_SYM opt_wild_or_where
14025 {
14026
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $$ = NEW_PTN PT_show_table_stats(@$, $3.wild, $3.where);
14027 }
14028 | SHOW INDEX_STATS_SYM opt_wild_or_where
14029 {
14030
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $$ = NEW_PTN PT_show_index_stats(@$, $3.wild, $3.where);
14031 }
14032 ;
14033
14034 show_create_procedure_stmt:
14035 SHOW CREATE PROCEDURE_SYM sp_name
14036 {
14037
1/2
✓ Branch 0 taken 598 times.
✗ Branch 1 not taken.
598 $$ = NEW_PTN PT_show_create_procedure(@$, $4);
14038 }
14039 ;
14040
14041 show_create_function_stmt:
14042 SHOW CREATE FUNCTION_SYM sp_name
14043 {
14044
1/2
✓ Branch 0 taken 407 times.
✗ Branch 1 not taken.
407 $$ = NEW_PTN PT_show_create_function(@$, $4);
14045 }
14046 ;
14047
14048 show_create_trigger_stmt:
14049 SHOW CREATE TRIGGER_SYM sp_name
14050 {
14051
1/2
✓ Branch 0 taken 506 times.
✗ Branch 1 not taken.
506 $$ = NEW_PTN PT_show_create_trigger(@$, $4);
14052 }
14053 ;
14054
14055 show_procedure_status_stmt:
14056 SHOW PROCEDURE_SYM STATUS_SYM opt_wild_or_where
14057 {
14058
1/2
✓ Branch 0 taken 488 times.
✗ Branch 1 not taken.
488 $$ = NEW_PTN PT_show_status_proc(@$, $4.wild, $4.where);
14059 }
14060 ;
14061
14062 show_function_status_stmt:
14063 SHOW FUNCTION_SYM STATUS_SYM opt_wild_or_where
14064 {
14065
1/2
✓ Branch 0 taken 458 times.
✗ Branch 1 not taken.
458 $$ = NEW_PTN PT_show_status_func(@$, $4.wild, $4.where);
14066 }
14067 ;
14068
14069 show_procedure_code_stmt:
14070 SHOW PROCEDURE_SYM CODE_SYM sp_name
14071 {
14072
1/2
✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
44 $$ = NEW_PTN PT_show_procedure_code(@$, $4);
14073 }
14074 ;
14075
14076 show_function_code_stmt:
14077 SHOW FUNCTION_SYM CODE_SYM sp_name
14078 {
14079
1/2
✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
32 $$ = NEW_PTN PT_show_function_code(@$, $4);
14080 }
14081 ;
14082
14083 show_create_event_stmt:
14084 SHOW CREATE EVENT_SYM sp_name
14085 {
14086
1/2
✓ Branch 0 taken 320 times.
✗ Branch 1 not taken.
320 $$ = NEW_PTN PT_show_create_event(@$, $4);
14087 }
14088 ;
14089
14090 show_create_user_stmt:
14091 SHOW CREATE USER user
14092 {
14093
1/2
✓ Branch 0 taken 997 times.
✗ Branch 1 not taken.
997 $$ = NEW_PTN PT_show_create_user(@$, $4);
14094 }
14095 ;
14096
14097 engine_or_all:
14098 ident_or_text
14099 9 | ALL { $$ = {}; }
14100 ;
14101
14102 master_or_binary:
14103 MASTER_SYM
14104 | BINARY_SYM
14105 ;
14106
14107 opt_storage:
14108 /* empty */
14109 | STORAGE_SYM
14110 ;
14111
14112 opt_db:
14113 34795 /* empty */ { $$= 0; }
14114 6232 | from_or_in ident { $$= $2.str; }
14115 ;
14116
14117 opt_full:
14118 4374 /* empty */ { $$= 0; }
14119 18 | FULL { $$= 1; }
14120 ;
14121
14122 opt_extended:
14123 1239 /* empty */ { $$= 0; }
14124 2 | EXTENDED_SYM { $$= 1; }
14125 ;
14126
14127 opt_show_cmd_type:
14128 32782 /* empty */ { $$= Show_cmd_type::STANDARD; }
14129 174 | FULL { $$= Show_cmd_type::FULL_SHOW; }
14130 14 | EXTENDED_SYM { $$= Show_cmd_type::EXTENDED_SHOW; }
14131 4 | EXTENDED_SYM FULL { $$= Show_cmd_type::EXTENDED_FULL_SHOW; }
14132 ;
14133
14134 from_or_in:
14135 FROM
14136 | IN_SYM
14137 ;
14138
14139 opt_binlog_in:
14140 3834 /* empty */ { $$ = {}; }
14141 14272 | IN_SYM TEXT_STRING_sys { $$ = $2; }
14142 ;
14143
14144 binlog_from:
14145 3984 /* empty */ { Lex->mi.pos = 4; /* skip magic number */ }
14146 14122 | FROM ulonglong_num { Lex->mi.pos = $2; }
14147 ;
14148
14149 opt_wild_or_where:
14150 55654 /* empty */ { $$ = {}; }
14151 120504 | LIKE TEXT_STRING_literal { $$ = { $2, {} }; }
14152 1982 | where_clause { $$ = { {}, $1 }; }
14153 ;
14154
14155 /* A Oracle compatible synonym for show */
14156 describe_stmt:
14157 describe_command table_ident opt_describe_column
14158 {
14159
1/2
✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
800 $$= NEW_PTN PT_show_fields(@$, Show_cmd_type::STANDARD, $2, $3);
14160 }
14161 ;
14162
14163 explain_stmt:
14164 describe_command opt_explain_analyze_type explainable_stmt
14165 {
14166
1/2
✓ Branch 0 taken 18957 times.
✗ Branch 1 not taken.
18957 $$= NEW_PTN PT_explain($2, $3);
14167 }
14168 ;
14169
14170 explainable_stmt:
14171 select_stmt
14172 | insert_stmt
14173 | replace_stmt
14174 | update_stmt
14175 | delete_stmt
14176 | FOR_SYM CONNECTION_SYM real_ulong_num
14177 {
14178
1/2
✓ Branch 0 taken 172 times.
✗ Branch 1 not taken.
172 $$= NEW_PTN PT_explain_for_connection(static_cast<my_thread_id>($3));
14179 }
14180 ;
14181
14182 describe_command:
14183 DESC
14184 | DESCRIBE
14185 ;
14186
14187 opt_explain_format_type:
14188 /* empty */
14189 {
14190 17378 $$= Explain_format_type::DEFAULT;
14191 }
14192 | FORMAT_SYM EQ ident_or_text
14193 {
14194
3/4
✓ Branch 0 taken 1594 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 876 times.
✓ Branch 3 taken 718 times.
1594 if (is_identifier($3, "JSON"))
14195 876 $$= Explain_format_type::JSON;
14196
3/4
✓ Branch 0 taken 718 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 132 times.
✓ Branch 3 taken 586 times.
718 else if (is_identifier($3, "TRADITIONAL"))
14197 132 $$= Explain_format_type::TRADITIONAL;
14198
3/4
✓ Branch 0 taken 586 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 584 times.
✓ Branch 3 taken 2 times.
586 else if (is_identifier($3, "TREE"))
14199 584 $$= Explain_format_type::TREE;
14200 else
14201 {
14202
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_UNKNOWN_EXPLAIN_FORMAT, MYF(0), $3.str);
14203 2 MYSQL_YYABORT;
14204 }
14205 }
14206
14207 opt_explain_analyze_type:
14208 ANALYZE_SYM opt_explain_format_type
14209 {
14210
3/3
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
26 switch ($2)
14211 {
14212 24 case Explain_format_type::DEFAULT:
14213 case Explain_format_type::TREE:
14214 24 $$= Explain_format_type::TREE_WITH_EXECUTE;
14215 24 break;
14216 1 case Explain_format_type::JSON:
14217
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_NOT_SUPPORTED_YET, MYF(0),
14218 "FORMAT=JSON with EXPLAIN ANALYZE");
14219 1 MYSQL_YYABORT;
14220 1 default:
14221
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_NOT_SUPPORTED_YET, MYF(0),
14222 "FORMAT=TRADITIONAL with EXPLAIN ANALYZE");
14223 1 MYSQL_YYABORT;
14224 }
14225 }
14226 | opt_explain_format_type
14227 {
14228
2/2
✓ Branch 0 taken 17355 times.
✓ Branch 1 taken 1589 times.
18944 if ($1 == Explain_format_type::DEFAULT)
14229 17355 $$= Explain_format_type::TRADITIONAL;
14230 else
14231 1589 $$= $1;
14232 }
14233 ;
14234
14235 opt_describe_column:
14236 788 /* empty */ { $$= LEX_STRING{ nullptr, 0 }; }
14237 | text_string
14238 {
14239
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if ($1 != nullptr)
14240 3 $$= $1->lex_string();
14241 }
14242 | ident
14243 ;
14244
14245
14246 /* flush things */
14247
14248 flush:
14249 FLUSH_SYM opt_no_write_to_binlog
14250 {
14251 24341 LEX *lex=Lex;
14252 24341 lex->sql_command= SQLCOM_FLUSH;
14253 24341 lex->type= 0;
14254 24341 lex->no_write_to_binlog= $2;
14255 }
14256 flush_options
14257 {}
14258 ;
14259
14260 flush_options:
14261 table_or_tables opt_table_list
14262 {
14263 15276 Lex->type|= REFRESH_TABLES;
14264 /*
14265 Set type of metadata and table locks for
14266 FLUSH TABLES table_list [WITH READ LOCK].
14267 */
14268 15276 YYPS->m_lock_type= TL_READ_NO_INSERT;
14269 15276 YYPS->m_mdl_type= MDL_SHARED_HIGH_PRIO;
14270
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 15276 times.
30552 if (Select->add_tables(YYTHD, $2, TL_OPTION_UPDATING,
14271
1/2
✓ Branch 0 taken 15276 times.
✗ Branch 1 not taken.
15276 YYPS->m_lock_type, YYPS->m_mdl_type))
14272 MYSQL_YYABORT;
14273 }
14274 opt_flush_lock {}
14275 | flush_options_list
14276 ;
14277
14278 opt_flush_lock:
14279 /* empty */ {}
14280 | WITH READ_SYM LOCK_SYM
14281 {
14282 755 TABLE_LIST *tables= Lex->query_tables;
14283 755 Lex->type|= REFRESH_READ_LOCK;
14284
2/2
✓ Branch 0 taken 151 times.
✓ Branch 1 taken 755 times.
906 for (; tables; tables= tables->next_global)
14285 {
14286 151 tables->mdl_request.set_type(MDL_SHARED_NO_WRITE);
14287 /* Don't try to flush views. */
14288 151 tables->required_type= dd::enum_table_type::BASE_TABLE;
14289 151 tables->open_type= OT_BASE_ONLY; /* Ignore temporary tables. */
14290 }
14291 }
14292 | FOR_SYM
14293 {
14294
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 360 times.
361 if (Lex->query_tables == NULL) // Table list can't be empty
14295 {
14296
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 YYTHD->syntax_error(ER_NO_TABLES_USED);
14297 1 MYSQL_YYABORT;
14298 }
14299 }
14300 EXPORT_SYM
14301 {
14302 360 TABLE_LIST *tables= Lex->query_tables;
14303 360 Lex->type|= REFRESH_FOR_EXPORT;
14304
2/2
✓ Branch 0 taken 378 times.
✓ Branch 1 taken 360 times.
738 for (; tables; tables= tables->next_global)
14305 {
14306 378 tables->mdl_request.set_type(MDL_SHARED_NO_WRITE);
14307 /* Don't try to flush views. */
14308 378 tables->required_type= dd::enum_table_type::BASE_TABLE;
14309 378 tables->open_type= OT_BASE_ONLY; /* Ignore temporary tables. */
14310 }
14311 }
14312 ;
14313
14314 flush_options_list:
14315 flush_options_list ',' flush_option
14316 | flush_option
14317 {}
14318 ;
14319
14320 flush_option:
14321 ERROR_SYM LOGS_SYM
14322 75 { Lex->type|= REFRESH_ERROR_LOG; }
14323 | ENGINE_SYM LOGS_SYM
14324 63 { Lex->type|= REFRESH_ENGINE_LOG; }
14325 | GENERAL LOGS_SYM
14326 61 { Lex->type|= REFRESH_GENERAL_LOG; }
14327 | SLOW LOGS_SYM
14328 61 { Lex->type|= REFRESH_SLOW_LOG; }
14329 | BINARY_SYM LOGS_SYM
14330 90 { Lex->type|= REFRESH_BINARY_LOG; }
14331 | RELAY LOGS_SYM opt_channel
14332 {
14333 132 Lex->type|= REFRESH_RELAY_LOG;
14334
2/4
✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 132 times.
132 if (Lex->set_channel_name($3))
14335 MYSQL_YYABORT; // OOM
14336 }
14337 | HOSTS_SYM
14338 69 { Lex->type|= REFRESH_HOSTS; }
14339 | PRIVILEGES
14340 3445 { Lex->type|= REFRESH_GRANT; }
14341 | LOGS_SYM
14342 1498 { Lex->type|= REFRESH_LOG; }
14343 | STATUS_SYM
14344 3104 { Lex->type|= REFRESH_STATUS; }
14345 | CLIENT_STATS_SYM
14346 58 { Lex->type|= REFRESH_CLIENT_STATS; }
14347 | USER_STATS_SYM
14348 59 { Lex->type|= REFRESH_USER_STATS; }
14349 | THREAD_STATS_SYM
14350 57 { Lex->type|= REFRESH_THREAD_STATS; }
14351 | TABLE_STATS_SYM
14352 58 { Lex->type|= REFRESH_TABLE_STATS; }
14353 | INDEX_STATS_SYM
14354 58 { Lex->type|= REFRESH_INDEX_STATS; }
14355 | RESOURCES
14356 112 { Lex->type|= REFRESH_USER_RESOURCES; }
14357 | OPTIMIZER_COSTS_SYM
14358 75 { Lex->type|= REFRESH_OPTIMIZER_COSTS; }
14359 | MEMORY_SYM PROFILE_SYM
14360 { Lex->type|= DUMP_MEMORY_PROFILE; }
14361 ;
14362
14363 opt_table_list:
14364 14490 /* empty */ { $$= NULL; }
14365 | table_list
14366 ;
14367
14368 reset:
14369 RESET_SYM
14370 {
14371 23244 LEX *lex=Lex;
14372 23244 lex->sql_command= SQLCOM_RESET; lex->type=0;
14373 }
14374 reset_options
14375 {}
14376 | RESET_SYM PERSIST_SYM opt_if_exists_ident
14377 {
14378 3762 LEX *lex=Lex;
14379 3762 lex->sql_command= SQLCOM_RESET;
14380 3762 lex->type|= REFRESH_PERSIST;
14381 3762 lex->option_type= OPT_PERSIST;
14382 }
14383 ;
14384
14385 reset_options:
14386 reset_options ',' reset_option
14387 | reset_option
14388 ;
14389
14390 opt_if_exists_ident:
14391 /* empty */
14392 {
14393 82 LEX *lex=Lex;
14394 82 lex->drop_if_exists= false;
14395 82 lex->name= NULL_STR;
14396 }
14397 | if_exists ident
14398 {
14399 3680 LEX *lex=Lex;
14400 3680 lex->drop_if_exists= $1;
14401 3680 lex->name= $2;
14402 }
14403 ;
14404
14405 reset_option:
14406 SLAVE
14407 {
14408 1020 Lex->type|= REFRESH_SLAVE;
14409 1020 Lex->set_replication_deprecated_syntax_used();
14410
1/2
✓ Branch 0 taken 1020 times.
✗ Branch 1 not taken.
1020 push_deprecated_warn(YYTHD, "RESET SLAVE", "RESET REPLICA");
14411 }
14412 opt_replica_reset_options opt_channel
14413 {
14414
2/4
✓ Branch 0 taken 1020 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1020 times.
1020 if (Lex->set_channel_name($4))
14415 MYSQL_YYABORT; // OOM
14416 }
14417 | REPLICA_SYM
14418 12327 { Lex->type|= REFRESH_REPLICA; }
14419 opt_replica_reset_options opt_channel
14420 {
14421
2/4
✓ Branch 0 taken 12327 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 12327 times.
12327 if (Lex->set_channel_name($4))
14422 MYSQL_YYABORT; // OOM
14423 }
14424 | MASTER_SYM
14425 {
14426 9897 Lex->type|= REFRESH_MASTER;
14427 /*
14428 Reset Master should acquire global read lock
14429 in order to avoid any parallel transaction commits
14430 while the reset operation is going on.
14431
14432 *Only if* the thread is not already acquired the global
14433 read lock, server will acquire global read lock
14434 during the operation and release it at the
14435 end of the reset operation.
14436 */
14437
2/2
✓ Branch 0 taken 9892 times.
✓ Branch 1 taken 5 times.
9897 if (!(YYTHD)->global_read_lock.is_acquired())
14438 9892 Lex->type|= REFRESH_TABLES | REFRESH_READ_LOCK;
14439 }
14440 source_reset_options
14441 ;
14442
14443 opt_replica_reset_options:
14444 1177 /* empty */ { Lex->reset_slave_info.all= false; }
14445 12170 | ALL { Lex->reset_slave_info.all= true; }
14446 ;
14447
14448 source_reset_options:
14449 /* empty */ {}
14450 | TO_SYM real_ulonglong_num
14451 {
14452
4/4
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 7 times.
12 if ($2 == 0 || $2 > MAX_ALLOWED_FN_EXT_RESET_MASTER)
14453 {
14454
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 my_error(ER_RESET_MASTER_TO_VALUE_OUT_OF_RANGE, MYF(0),
14455 $2, MAX_ALLOWED_FN_EXT_RESET_MASTER);
14456 5 MYSQL_YYABORT;
14457 }
14458 else
14459 7 Lex->next_binlog_file_nr = $2;
14460 }
14461 ;
14462
14463 purge:
14464 PURGE
14465 {
14466 161 LEX *lex=Lex;
14467 161 lex->type=0;
14468 161 lex->sql_command = SQLCOM_PURGE;
14469 }
14470 purge_options
14471 {}
14472 ;
14473
14474 purge_options:
14475 master_or_binary LOGS_SYM purge_option
14476 ;
14477
14478 purge_option:
14479 TO_SYM TEXT_STRING_sys
14480 {
14481 141 Lex->to_log = $2.str;
14482 }
14483 | BEFORE_SYM expr
14484 {
14485
7/14
✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 19 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 19 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 19 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 19 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 19 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 19 times.
19 ITEMIZE($2, &$2);
14486
14487 19 LEX *lex= Lex;
14488 19 lex->purge_value_list.clear();
14489
1/2
✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
19 lex->purge_value_list.push_front($2);
14490 19 lex->sql_command= SQLCOM_PURGE_BEFORE;
14491 }
14492 ;
14493
14494 /* kill threads */
14495
14496 kill:
14497 KILL_SYM kill_option expr
14498 {
14499
7/14
✓ Branch 0 taken 2728 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2728 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2728 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2728 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2728 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2728 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 2728 times.
2728 ITEMIZE($3, &$3);
14500
14501 2728 LEX *lex=Lex;
14502 2728 lex->kill_value_list.clear();
14503
1/2
✓ Branch 0 taken 2728 times.
✗ Branch 1 not taken.
2728 lex->kill_value_list.push_front($3);
14504 2728 lex->sql_command= SQLCOM_KILL;
14505 }
14506 ;
14507
14508 kill_option:
14509 2456 /* empty */ { Lex->type= 0; }
14510 46 | CONNECTION_SYM { Lex->type= 0; }
14511 227 | QUERY_SYM { Lex->type= ONLY_KILL_QUERY; }
14512 ;
14513
14514 /* change database */
14515
14516 use:
14517 USE_SYM ident
14518 {
14519 86576 LEX *lex=Lex;
14520 86576 lex->sql_command=SQLCOM_CHANGE_DB;
14521 86576 lex->query_block->db= $2.str;
14522 }
14523 ;
14524
14525 /* import, export of files */
14526
14527 load_stmt:
14528 LOAD /* 1 */
14529 data_or_xml /* 2 */
14530 load_data_lock /* 3 */
14531 opt_local /* 4 */
14532 INFILE /* 5 */
14533 TEXT_STRING_filesystem /* 6 */
14534 opt_duplicate /* 7 */
14535 INTO /* 8 */
14536 TABLE_SYM /* 9 */
14537 table_ident /* 10 */
14538 opt_use_partition /* 11 */
14539 opt_load_data_charset /* 12 */
14540 opt_xml_rows_identified_by /* 13 */
14541 opt_field_term /* 14 */
14542 opt_line_term /* 15 */
14543 opt_ignore_lines /* 16 */
14544 opt_field_or_var_spec /* 17 */
14545 opt_load_data_set_spec /* 18 */
14546 {
14547
1/2
✓ Branch 0 taken 44447 times.
✗ Branch 1 not taken.
88894 $$= NEW_PTN PT_load_table($2, // data_or_xml
14548 44447 $3, // load_data_lock
14549 44447 $4, // opt_local
14550 44447 $6, // TEXT_STRING_filesystem
14551 44447 $7, // opt_duplicate
14552 44447 $10, // table_ident
14553 44447 $11, // opt_use_partition
14554 44447 $12, // opt_load_data_charset
14555 44447 $13, // opt_xml_rows_identified_by
14556 44447 $14, // opt_field_term
14557 44447 $15, // opt_line_term
14558 44447 $16, // opt_ignore_lines
14559 44447 $17, // opt_field_or_var_spec
14560 $18.set_var_list,// opt_load_data_set_spec
14561 $18.set_expr_list,
14562
1/2
✓ Branch 0 taken 44447 times.
✗ Branch 1 not taken.
88894 $18.set_expr_str_list);
14563 }
14564 ;
14565
14566 data_or_xml:
14567 44403 DATA_SYM{ $$= FILETYPE_CSV; }
14568 45 | XML_SYM { $$= FILETYPE_XML; }
14569 ;
14570
14571 opt_local:
14572 43167 /* empty */ { $$= false; }
14573 1281 | LOCAL_SYM { $$= true; }
14574 ;
14575
14576 load_data_lock:
14577 43862 /* empty */ { $$= TL_WRITE_DEFAULT; }
14578 305 | CONCURRENT { $$= TL_WRITE_CONCURRENT_INSERT; }
14579 281 | LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; }
14580 ;
14581
14582 opt_duplicate:
14583 44325 /* empty */ { $$= On_duplicate::ERROR; }
14584 | duplicate
14585 ;
14586
14587 duplicate:
14588 38 REPLACE_SYM { $$= On_duplicate::REPLACE_DUP; }
14589 98 | IGNORE_SYM { $$= On_duplicate::IGNORE_DUP; }
14590 ;
14591
14592 opt_field_term:
14593 53755 /* empty */ { $$.cleanup(); }
14594 16158 | COLUMNS field_term_list { $$= $2; }
14595 ;
14596
14597 field_term_list:
14598 field_term_list field_term
14599 {
14600 15281 $$= $1;
14601 15281 $$.merge_field_separators($2);
14602 }
14603 | field_term
14604 ;
14605
14606 field_term:
14607 TERMINATED BY text_string
14608 {
14609 14451 $$.cleanup();
14610 14451 $$.field_term= $3;
14611 }
14612 | OPTIONALLY ENCLOSED BY text_string
14613 {
14614 1722 $$.cleanup();
14615 1722 $$.enclosed= $4;
14616 1722 $$.opt_enclosed= 1;
14617 }
14618 | ENCLOSED BY text_string
14619 {
14620 1862 $$.cleanup();
14621 1862 $$.enclosed= $3;
14622 }
14623 | ESCAPED BY text_string
14624 {
14625 13404 $$.cleanup();
14626 13404 $$.escaped= $3;
14627 }
14628 ;
14629
14630 opt_line_term:
14631 67190 /* empty */ { $$.cleanup(); }
14632 2723 | LINES line_term_list { $$= $2; }
14633 ;
14634
14635 line_term_list:
14636 line_term_list line_term
14637 {
14638 16 $$= $1;
14639 16 $$.merge_line_separators($2);
14640 }
14641 | line_term
14642 ;
14643
14644 line_term:
14645 TERMINATED BY text_string
14646 {
14647 2701 $$.cleanup();
14648 2701 $$.line_term= $3;
14649 }
14650 | STARTING BY text_string
14651 {
14652 38 $$.cleanup();
14653 38 $$.line_start= $3;
14654 }
14655 ;
14656
14657 opt_xml_rows_identified_by:
14658 44436 /* empty */ { $$= nullptr; }
14659 11 | ROWS_SYM IDENTIFIED_SYM BY text_string { $$= $4; }
14660 ;
14661
14662 opt_ignore_lines:
14663 31099 /* empty */ { $$= 0; }
14664 13348 | IGNORE_SYM NUM lines_or_rows { $$= atol($2.str); }
14665 ;
14666
14667 lines_or_rows:
14668 LINES
14669 | ROWS_SYM
14670 ;
14671
14672 opt_field_or_var_spec:
14673 30925 /* empty */ { $$= nullptr; }
14674 13521 | '(' fields_or_vars ')' { $$= $2; }
14675 1 | '(' ')' { $$= nullptr; }
14676 ;
14677
14678 fields_or_vars:
14679 fields_or_vars ',' field_or_var
14680 {
14681 203 $$= $1;
14682
2/4
✓ Branch 0 taken 203 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 203 times.
203 if ($$->push_back($3))
14683 MYSQL_YYABORT; // OOM
14684 }
14685 | field_or_var
14686 {
14687
2/4
✓ Branch 0 taken 13521 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13521 times.
✗ Branch 3 not taken.
13521 $$= NEW_PTN PT_item_list;
14688
4/8
✓ Branch 0 taken 13521 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13521 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 13521 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 13521 times.
13521 if ($$ == nullptr || $$->push_back($1))
14689 MYSQL_YYABORT; // OOM
14690 }
14691 ;
14692
14693 field_or_var:
14694 simple_ident_nospvar
14695 | '@' ident_or_text
14696 {
14697
2/4
✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 60 times.
✗ Branch 3 not taken.
60 $$= NEW_PTN Item_user_var_as_out_param(@$, $2);
14698 }
14699 ;
14700
14701 opt_load_data_set_spec:
14702 44379 /* empty */ { $$= {nullptr, nullptr, nullptr}; }
14703 68 | SET_SYM load_data_set_list { $$= $2; }
14704 ;
14705
14706 load_data_set_list:
14707 load_data_set_list ',' load_data_set_elem
14708 {
14709 5 $$= $1;
14710
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 if ($$.set_var_list->push_back($3.set_var) ||
14711
4/8
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5 times.
10 $$.set_expr_list->push_back($3.set_expr) ||
14712
2/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
5 $$.set_expr_str_list->push_back($3.set_expr_str))
14713 MYSQL_YYABORT; // OOM
14714 }
14715 | load_data_set_elem
14716 {
14717
2/4
✓ Branch 0 taken 68 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 68 times.
✗ Branch 3 not taken.
68 $$.set_var_list= NEW_PTN PT_item_list;
14718
2/4
✓ Branch 0 taken 68 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 68 times.
136 if ($$.set_var_list == nullptr ||
14719
2/4
✓ Branch 0 taken 68 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 68 times.
68 $$.set_var_list->push_back($1.set_var))
14720 MYSQL_YYABORT; // OOM
14721
14722
2/4
✓ Branch 0 taken 68 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 68 times.
✗ Branch 3 not taken.
68 $$.set_expr_list= NEW_PTN PT_item_list;
14723
2/4
✓ Branch 0 taken 68 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 68 times.
136 if ($$.set_expr_list == nullptr ||
14724
2/4
✓ Branch 0 taken 68 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 68 times.
68 $$.set_expr_list->push_back($1.set_expr))
14725 MYSQL_YYABORT; // OOM
14726
14727
1/2
✓ Branch 0 taken 68 times.
✗ Branch 1 not taken.
68 $$.set_expr_str_list= NEW_PTN List<String>;
14728
2/4
✓ Branch 0 taken 68 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 68 times.
136 if ($$.set_expr_str_list == nullptr ||
14729
2/4
✓ Branch 0 taken 68 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 68 times.
68 $$.set_expr_str_list->push_back($1.set_expr_str))
14730 MYSQL_YYABORT; // OOM
14731 }
14732 ;
14733
14734 load_data_set_elem:
14735 simple_ident_nospvar equal expr_or_default
14736 {
14737 73 size_t length= @3.cpp.end - @2.cpp.start;
14738
14739
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 73 times.
73 if ($3 == nullptr)
14740 MYSQL_YYABORT; // OOM
14741
1/2
✓ Branch 0 taken 73 times.
✗ Branch 1 not taken.
73 $3->item_name.copy(@2.cpp.start, length, YYTHD->charset());
14742
14743 73 $$.set_var= $1;
14744 73 $$.set_expr= $3;
14745 146 $$.set_expr_str= NEW_PTN String(@2.cpp.start,
14746 length,
14747
1/2
✓ Branch 0 taken 73 times.
✗ Branch 1 not taken.
73 YYTHD->charset());
14748
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 73 times.
73 if ($$.set_expr_str == nullptr)
14749 MYSQL_YYABORT; // OOM
14750 }
14751 ;
14752
14753 /* Common definitions */
14754
14755 text_literal:
14756 TEXT_STRING
14757 {
14758
1/2
✓ Branch 0 taken 36745682 times.
✗ Branch 1 not taken.
73491362 $$= NEW_PTN PTI_text_literal_text_string(@$,
14759
1/2
✓ Branch 0 taken 36745680 times.
✗ Branch 1 not taken.
73491351 YYTHD->m_parser_state->m_lip.text_string_is_7bit(), $1);
14760 }
14761 | NCHAR_STRING
14762 {
14763
1/2
✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
68 $$= NEW_PTN PTI_text_literal_nchar_string(@$,
14764
1/2
✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
68 YYTHD->m_parser_state->m_lip.text_string_is_7bit(), $1);
14765
1/2
✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
34 warn_about_deprecated_national(YYTHD);
14766 }
14767 | UNDERSCORE_CHARSET TEXT_STRING
14768 {
14769
1/2
✓ Branch 0 taken 230712 times.
✗ Branch 1 not taken.
461424 $$= NEW_PTN PTI_text_literal_underscore_charset(@$,
14770
1/2
✓ Branch 0 taken 230712 times.
✗ Branch 1 not taken.
461424 YYTHD->m_parser_state->m_lip.text_string_is_7bit(), $1, $2);
14771 }
14772 | text_literal TEXT_STRING_literal
14773 {
14774
1/2
✓ Branch 0 taken 6824 times.
✗ Branch 1 not taken.
13648 $$= NEW_PTN PTI_text_literal_concat(@$,
14775
1/2
✓ Branch 0 taken 6824 times.
✗ Branch 1 not taken.
13648 YYTHD->m_parser_state->m_lip.text_string_is_7bit(), $1, $2);
14776 }
14777 ;
14778
14779 text_string:
14780 TEXT_STRING_literal
14781 {
14782 4337988 $$= NEW_PTN String($1.str, $1.length,
14783
1/2
✓ Branch 0 taken 4337988 times.
✗ Branch 1 not taken.
4337988 YYTHD->variables.collation_connection);
14784
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4337988 times.
4337988 if ($$ == NULL)
14785 MYSQL_YYABORT;
14786 }
14787 | HEX_NUM
14788 {
14789
1/2
✓ Branch 0 taken 2531 times.
✗ Branch 1 not taken.
2531 LEX_CSTRING s= Item_hex_string::make_hex_str($1.str, $1.length);
14790
1/2
✓ Branch 0 taken 2531 times.
✗ Branch 1 not taken.
2531 $$= NEW_PTN String(s.str, s.length, &my_charset_bin);
14791
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2531 times.
2531 if ($$ == NULL)
14792 MYSQL_YYABORT;
14793 }
14794 | BIN_NUM
14795 {
14796
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 LEX_CSTRING s= Item_bin_string::make_bin_str($1.str, $1.length);
14797
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 $$= NEW_PTN String(s.str, s.length, &my_charset_bin);
14798
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 if ($$ == NULL)
14799 MYSQL_YYABORT;
14800 }
14801 ;
14802
14803 param_marker:
14804 PARAM_MARKER
14805 {
14806 auto *i= NEW_PTN Item_param(@$, YYMEM_ROOT,
14807
2/4
✓ Branch 0 taken 275249 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 275249 times.
✗ Branch 3 not taken.
275249 (uint) (@1.raw.start - YYLIP->get_buf()));
14808
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 275249 times.
275249 if (i == NULL)
14809 MYSQL_YYABORT;
14810 275249 auto *lex= Lex;
14811 /*
14812 If we are not re-parsing a CTE definition, this is a
14813 real parameter, so add it to param_list.
14814 */
14815
3/4
✓ Branch 0 taken 275241 times.
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 275249 times.
550490 if (!lex->reparse_common_table_expr_at &&
14816
2/4
✓ Branch 0 taken 275241 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 275241 times.
275241 lex->param_list.push_back(i))
14817 MYSQL_YYABORT;
14818 275249 $$= i;
14819 }
14820 ;
14821
14822 signed_literal:
14823 literal
14824 | '+' NUM_literal { $$= $2; }
14825 | '-' NUM_literal
14826 {
14827
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 124 times.
124 if ($2 == NULL)
14828 MYSQL_YYABORT; // OOM
14829 124 $2->max_length++;
14830
1/2
✓ Branch 0 taken 124 times.
✗ Branch 1 not taken.
124 $$= $2->neg();
14831 }
14832 ;
14833
14834 signed_literal_or_null:
14835 signed_literal
14836 | null_as_literal
14837 ;
14838
14839 null_as_literal:
14840 NULL_SYM
14841 {
14842 8567661 Lex_input_stream *lip= YYLIP;
14843 /*
14844 For the digest computation, in this context only,
14845 NULL is considered a literal, hence reduced to '?'
14846 REDUCE:
14847 TOK_GENERIC_VALUE := NULL_SYM
14848 */
14849
1/2
✓ Branch 0 taken 8567844 times.
✗ Branch 1 not taken.
8567661 lip->reduce_digest_token(TOK_GENERIC_VALUE, NULL_SYM);
14850
2/4
✓ Branch 0 taken 8567764 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8567823 times.
✗ Branch 3 not taken.
8567844 $$= NEW_PTN Item_null(@$);
14851 }
14852 ;
14853
14854 literal:
14855 36955354 text_literal { $$= $1; }
14856 54089607 | NUM_literal { $$= $1; }
14857 | temporal_literal
14858 | FALSE_SYM
14859 {
14860
2/4
✓ Branch 0 taken 245224 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 245224 times.
✗ Branch 3 not taken.
245224 $$= NEW_PTN Item_func_false(@$);
14861 }
14862 | TRUE_SYM
14863 {
14864
2/4
✓ Branch 0 taken 170259 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 170259 times.
✗ Branch 3 not taken.
170259 $$= NEW_PTN Item_func_true(@$);
14865 }
14866 | HEX_NUM
14867 {
14868
2/4
✓ Branch 0 taken 20317 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 20317 times.
✗ Branch 3 not taken.
20317 $$= NEW_PTN Item_hex_string(@$, $1);
14869 }
14870 | BIN_NUM
14871 {
14872
2/4
✓ Branch 0 taken 6338 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6338 times.
✗ Branch 3 not taken.
6338 $$= NEW_PTN Item_bin_string(@$, $1);
14873 }
14874 | UNDERSCORE_CHARSET HEX_NUM
14875 {
14876
2/4
✓ Branch 0 taken 9087 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9087 times.
✗ Branch 3 not taken.
9087 $$= NEW_PTN PTI_literal_underscore_charset_hex_num(@$, $1, $2);
14877 }
14878 | UNDERSCORE_CHARSET BIN_NUM
14879 {
14880
2/4
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
12 $$= NEW_PTN PTI_literal_underscore_charset_bin_num(@$, $1, $2);
14881 }
14882 ;
14883
14884 literal_or_null:
14885 literal
14886 | null_as_literal
14887 ;
14888
14889 NUM_literal:
14890 int64_literal
14891 | DECIMAL_NUM
14892 {
14893
2/4
✓ Branch 0 taken 287233 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 287230 times.
✗ Branch 3 not taken.
287233 $$= NEW_PTN Item_decimal(@$, $1.str, $1.length, YYCSCL);
14894 }
14895 | FLOAT_NUM
14896 {
14897
2/4
✓ Branch 0 taken 5582 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5582 times.
✗ Branch 3 not taken.
5582 $$= NEW_PTN Item_float(@$, $1.str, $1.length);
14898 }
14899 ;
14900
14901 /*
14902 int64_literal if for unsigned exact integer literals in a range of
14903 [0 .. 2^64-1].
14904 */
14905 int64_literal:
14906
2/4
✓ Branch 0 taken 53192007 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 53192104 times.
✗ Branch 3 not taken.
53191905 NUM { $$ = NEW_PTN Item_int(@$, $1); }
14907
2/4
✓ Branch 0 taken 603014 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 603014 times.
✗ Branch 3 not taken.
603013 | LONG_NUM { $$ = NEW_PTN Item_int(@$, $1); }
14908
2/4
✓ Branch 0 taken 3210 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3210 times.
✗ Branch 3 not taken.
3210 | ULONGLONG_NUM { $$ = NEW_PTN Item_uint(@$, $1.str, $1.length); }
14909 ;
14910
14911
14912 temporal_literal:
14913 DATE_SYM TEXT_STRING
14914 {
14915
2/4
✓ Branch 0 taken 125 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 125 times.
✗ Branch 3 not taken.
125 $$= NEW_PTN PTI_temporal_literal(@$, $2, MYSQL_TYPE_DATE, YYCSCL);
14916 }
14917 | TIME_SYM TEXT_STRING
14918 {
14919
2/4
✓ Branch 0 taken 383 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 383 times.
✗ Branch 3 not taken.
383 $$= NEW_PTN PTI_temporal_literal(@$, $2, MYSQL_TYPE_TIME, YYCSCL);
14920 }
14921 | TIMESTAMP_SYM TEXT_STRING
14922 {
14923
2/4
✓ Branch 0 taken 789 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 789 times.
✗ Branch 3 not taken.
789 $$= NEW_PTN PTI_temporal_literal(@$, $2, MYSQL_TYPE_DATETIME, YYCSCL);
14924 }
14925 ;
14926
14927 opt_interval:
14928 15 /* empty */ { $$ = false; }
14929 2 | INTERVAL_SYM { $$ = true; }
14930 ;
14931
14932
14933 /**********************************************************************
14934 ** Creating different items.
14935 **********************************************************************/
14936
14937 insert_ident:
14938 simple_ident_nospvar
14939 | table_wild
14940 ;
14941
14942 table_wild:
14943 ident '.' '*'
14944 {
14945
2/4
✓ Branch 0 taken 4104 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4104 times.
✗ Branch 3 not taken.
4104 $$ = NEW_PTN Item_asterisk(@$, nullptr, $1.str);
14946 }
14947 | ident '.' ident '.' '*'
14948 {
14949
2/4
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 15 times.
15 if (check_and_convert_db_name(&$1, false) != Ident_name_check::OK)
14950 MYSQL_YYABORT;
14951
2/4
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 15 times.
15 auto schema_name = YYCLIENT_NO_SCHEMA ? nullptr : $1.str;
14952
2/4
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
15 $$ = NEW_PTN Item_asterisk(@$, schema_name, $3.str);
14953 }
14954 ;
14955
14956 order_expr:
14957 expr opt_ordering_direction
14958 {
14959
2/4
✓ Branch 0 taken 1198214 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1198215 times.
✗ Branch 3 not taken.
1198214 $$= NEW_PTN PT_order_expr($1, $2);
14960 }
14961 ;
14962
14963 grouping_expr:
14964 expr
14965 {
14966
2/4
✓ Branch 0 taken 188529 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 188529 times.
✗ Branch 3 not taken.
188529 $$= NEW_PTN PT_order_expr($1, ORDER_NOT_RELEVANT);
14967 }
14968 ;
14969
14970 simple_ident:
14971 ident
14972 {
14973
2/4
✓ Branch 0 taken 10321619 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10321638 times.
✗ Branch 3 not taken.
10321639 $$= NEW_PTN PTI_simple_ident_ident(@$, to_lex_cstring($1));
14974 }
14975 | simple_ident_q
14976 ;
14977
14978 simple_ident_nospvar:
14979 ident
14980 {
14981
2/4
✓ Branch 0 taken 24857917 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24858335 times.
✗ Branch 3 not taken.
24858294 $$= NEW_PTN PTI_simple_ident_nospvar_ident(@$, $1);
14982 }
14983 | simple_ident_q
14984 ;
14985
14986 simple_ident_q:
14987 ident '.' ident
14988 {
14989
2/4
✓ Branch 0 taken 32370380 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32370411 times.
✗ Branch 3 not taken.
32370407 $$= NEW_PTN PTI_simple_ident_q_2d(@$, $1.str, $3.str);
14990 }
14991 | ident '.' ident '.' ident
14992 {
14993
2/4
✓ Branch 0 taken 1724061 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1724061 times.
1724061 if (check_and_convert_db_name(&$1, false) != Ident_name_check::OK)
14994 MYSQL_YYABORT;
14995
2/4
✓ Branch 0 taken 1724061 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1724061 times.
✗ Branch 3 not taken.
1724061 $$= NEW_PTN PTI_simple_ident_q_3d(@$, $1.str, $3.str, $5.str);
14996 }
14997 ;
14998
14999 table_ident:
15000 ident
15001 {
15002
1/2
✓ Branch 0 taken 9129562 times.
✗ Branch 1 not taken.
9129593 $$= NEW_PTN Table_ident(to_lex_cstring($1));
15003
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9129392 times.
9129392 if ($$ == NULL)
15004 MYSQL_YYABORT;
15005 }
15006 | ident '.' ident
15007 {
15008
1/2
✓ Branch 0 taken 7462075 times.
✗ Branch 1 not taken.
7462073 auto schema_name = YYCLIENT_NO_SCHEMA ? LEX_CSTRING{}
15009
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7462075 times.
7462075 : to_lex_cstring($1.str);
15010
1/2
✓ Branch 0 taken 7462075 times.
✗ Branch 1 not taken.
7462077 $$= NEW_PTN Table_ident(schema_name, to_lex_cstring($3));
15011
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7462070 times.
7462070 if ($$ == NULL)
15012 MYSQL_YYABORT;
15013 }
15014 ;
15015
15016 table_ident_opt_wild:
15017 ident opt_wild
15018 {
15019
1/2
✓ Branch 0 taken 1583 times.
✗ Branch 1 not taken.
1583 $$= NEW_PTN Table_ident(to_lex_cstring($1));
15020
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1583 times.
1583 if ($$ == NULL)
15021 MYSQL_YYABORT;
15022 }
15023 | ident '.' ident opt_wild
15024 {
15025 278 $$= NEW_PTN Table_ident(YYTHD->get_protocol(),
15026 278 to_lex_cstring($1),
15027
2/4
✓ Branch 0 taken 278 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 278 times.
✗ Branch 3 not taken.
278 to_lex_cstring($3), 0);
15028
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 278 times.
278 if ($$ == NULL)
15029 MYSQL_YYABORT;
15030 }
15031 ;
15032
15033 IDENT_sys:
15034 780314 IDENT { $$= $1; }
15035 | IDENT_QUOTED
15036 {
15037 152801107 THD *thd= YYTHD;
15038
15039
2/2
✓ Branch 0 taken 87881259 times.
✓ Branch 1 taken 64919848 times.
152801107 if (thd->charset_is_system_charset)
15040 {
15041 87881259 const CHARSET_INFO *cs= system_charset_info;
15042 int dummy_error;
15043 175762731 size_t wlen= cs->cset->well_formed_len(cs, $1.str,
15044
1/2
✓ Branch 0 taken 87881472 times.
✗ Branch 1 not taken.
87881259 $1.str+$1.length,
15045 $1.length, &dummy_error);
15046
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 87881456 times.
87881472 if (wlen < $1.length)
15047 {
15048
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 ErrConvString err($1.str, $1.length, &my_charset_bin);
15049 16 my_error(ER_INVALID_CHARACTER_STRING, MYF(0),
15050
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 cs->csname, err.ptr());
15051 16 MYSQL_YYABORT;
15052 }
15053 87881456 $$= $1;
15054 }
15055 else
15056 {
15057
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 64920991 times.
129840839 if (thd->convert_string(&$$, system_charset_info,
15058
1/2
✓ Branch 0 taken 64920991 times.
✗ Branch 1 not taken.
64920231 $1.str, $1.length, thd->charset()))
15059 MYSQL_YYABORT;
15060 }
15061 }
15062 ;
15063
15064 TEXT_STRING_sys_nonewline:
15065 TEXT_STRING_sys
15066 {
15067
3/4
✓ Branch 0 taken 34692 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 34688 times.
✓ Branch 3 taken 4 times.
34691 if (!strcont($1.str, "\n"))
15068 34688 $$= $1;
15069 else
15070 {
15071
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 my_error(ER_WRONG_VALUE, MYF(0), "argument contains not-allowed LF", $1.str);
15072 4 MYSQL_YYABORT;
15073 }
15074 }
15075 ;
15076
15077 filter_wild_db_table_string:
15078 TEXT_STRING_sys_nonewline
15079 {
15080
3/4
✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29 times.
✓ Branch 3 taken 5 times.
34 if (strcont($1.str, "."))
15081 29 $$= $1;
15082 else
15083 {
15084
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 my_error(ER_INVALID_RPL_WILD_TABLE_FILTER_PATTERN, MYF(0));
15085 5 MYSQL_YYABORT;
15086 }
15087 }
15088 ;
15089
15090 TEXT_STRING_sys:
15091 TEXT_STRING
15092 {
15093 521699 THD *thd= YYTHD;
15094
15095
2/2
✓ Branch 0 taken 20069 times.
✓ Branch 1 taken 501630 times.
521699 if (thd->charset_is_system_charset)
15096 20069 $$= $1;
15097 else
15098 {
15099
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 501631 times.
1003261 if (thd->convert_string(&$$, system_charset_info,
15100
1/2
✓ Branch 0 taken 501631 times.
✗ Branch 1 not taken.
501630 $1.str, $1.length, thd->charset()))
15101 MYSQL_YYABORT;
15102 }
15103 }
15104 ;
15105
15106 TEXT_STRING_literal:
15107 TEXT_STRING
15108 {
15109 4483140 THD *thd= YYTHD;
15110
15111
2/2
✓ Branch 0 taken 4482987 times.
✓ Branch 1 taken 153 times.
4483140 if (thd->charset_is_collation_connection)
15112 4482987 $$= $1;
15113 else
15114 {
15115
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 153 times.
306 if (thd->convert_string(&$$, thd->variables.collation_connection,
15116
1/2
✓ Branch 0 taken 153 times.
✗ Branch 1 not taken.
153 $1.str, $1.length, thd->charset()))
15117 MYSQL_YYABORT;
15118 }
15119 }
15120 ;
15121
15122 TEXT_STRING_filesystem:
15123 TEXT_STRING
15124 {
15125 70533 THD *thd= YYTHD;
15126
15127
2/2
✓ Branch 0 taken 70530 times.
✓ Branch 1 taken 3 times.
70533 if (thd->charset_is_character_set_filesystem)
15128 70530 $$= $1;
15129 else
15130 {
15131
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
6 if (thd->convert_string(&$$,
15132 thd->variables.character_set_filesystem,
15133
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 $1.str, $1.length, thd->charset()))
15134 MYSQL_YYABORT;
15135 }
15136 }
15137 ;
15138
15139 TEXT_STRING_password:
15140 TEXT_STRING
15141 ;
15142
15143 TEXT_STRING_hash:
15144 TEXT_STRING_sys
15145 | HEX_NUM
15146 {
15147
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 $$= to_lex_string(Item_hex_string::make_hex_str($1.str, $1.length));
15148 }
15149 ;
15150
15151 TEXT_STRING_validated:
15152 TEXT_STRING
15153 {
15154 78527 THD *thd= YYTHD;
15155
15156
2/2
✓ Branch 0 taken 4893 times.
✓ Branch 1 taken 73634 times.
78527 if (thd->charset_is_system_charset)
15157 4893 $$= $1;
15158 else
15159 {
15160
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 73632 times.
147268 if (thd->convert_string(&$$, system_charset_info,
15161
1/2
✓ Branch 0 taken 73634 times.
✗ Branch 1 not taken.
73634 $1.str, $1.length, thd->charset(), true))
15162 2 MYSQL_YYABORT;
15163 }
15164 }
15165 ;
15166
15167 ident:
15168 144185390 IDENT_sys { $$=$1; }
15169 | ident_keyword
15170 {
15171 14200349 THD *thd= YYTHD;
15172
1/2
✓ Branch 0 taken 14200061 times.
✗ Branch 1 not taken.
14200349 $$.str= thd->strmake($1.str, $1.length);
15173
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14200061 times.
14200061 if ($$.str == NULL)
15174 MYSQL_YYABORT;
15175 14200061 $$.length= $1.length;
15176 }
15177 ;
15178
15179 role_ident:
15180 IDENT_sys
15181 | role_keyword
15182 {
15183
1/2
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
12 $$.str= YYTHD->strmake($1.str, $1.length);
15184
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
12 if ($$.str == NULL)
15185 MYSQL_YYABORT;
15186 12 $$.length= $1.length;
15187 }
15188 ;
15189
15190 label_ident:
15191 10357 IDENT_sys { $$=to_lex_cstring($1); }
15192 | label_keyword
15193 {
15194 80 THD *thd= YYTHD;
15195
1/2
✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
80 $$.str= thd->strmake($1.str, $1.length);
15196
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 80 times.
80 if ($$.str == NULL)
15197 MYSQL_YYABORT;
15198 80 $$.length= $1.length;
15199 }
15200 ;
15201
15202 lvalue_ident:
15203 IDENT_sys
15204 | lvalue_keyword
15205 {
15206
1/2
✓ Branch 0 taken 25335 times.
✗ Branch 1 not taken.
25334 $$.str= YYTHD->strmake($1.str, $1.length);
15207
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 25335 times.
25335 if ($$.str == NULL)
15208 MYSQL_YYABORT;
15209 25335 $$.length= $1.length;
15210 }
15211 ;
15212
15213 ident_or_text:
15214 3902453 ident { $$=$1;}
15215 181233 | TEXT_STRING_sys { $$=$1;}
15216 1595244 | LEX_HOSTNAME { $$=$1;}
15217 ;
15218
15219 role_ident_or_text:
15220 role_ident
15221 | TEXT_STRING_sys
15222 | LEX_HOSTNAME
15223 ;
15224
15225 user_ident_or_text:
15226 ident_or_text
15227 {
15228
3/4
✓ Branch 0 taken 11319 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 11318 times.
11319 if (!($$= LEX_USER::alloc(YYTHD, &$1, NULL)))
15229 1 MYSQL_YYABORT;
15230 }
15231 | ident_or_text '@' ident_or_text
15232 {
15233
3/4
✓ Branch 0 taken 384198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 67 times.
✓ Branch 3 taken 384131 times.
384196 if (!($$= LEX_USER::alloc(YYTHD, &$1, &$3)))
15234 67 MYSQL_YYABORT;
15235 }
15236 ;
15237
15238 user:
15239 user_ident_or_text
15240 {
15241 395408 $$=$1;
15242 }
15243 | CURRENT_USER optional_braces
15244 {
15245
2/4
✓ Branch 0 taken 136 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 136 times.
136 if (!($$= LEX_USER::alloc(YYTHD)))
15246 MYSQL_YYABORT;
15247 /*
15248 empty LEX_USER means current_user and
15249 will be handled in the get_current_user() function
15250 later
15251 */
15252 }
15253 ;
15254
15255 role:
15256 role_ident_or_text
15257 {
15258
3/4
✓ Branch 0 taken 2313 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 2312 times.
2313 if (!($$= LEX_USER::alloc(YYTHD, &$1, NULL)))
15259 1 MYSQL_YYABORT;
15260 }
15261 | role_ident_or_text '@' ident_or_text
15262 {
15263
2/4
✓ Branch 0 taken 129 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 129 times.
129 if (!($$= LEX_USER::alloc(YYTHD, &$1, &$3)))
15264 MYSQL_YYABORT;
15265 }
15266 ;
15267
15268 schema:
15269 ident
15270 {
15271 3658 $$ = $1;
15272
2/4
✓ Branch 0 taken 3658 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3658 times.
3658 if (check_and_convert_db_name(&$$, false) != Ident_name_check::OK)
15273 MYSQL_YYABORT;
15274 }
15275 ;
15276
15277 /*
15278 Non-reserved keywords are allowed as unquoted identifiers in general.
15279
15280 OTOH, in a few particular cases statement-specific rules are used
15281 instead of `ident_keyword` to avoid grammar ambiguities:
15282
15283 * `label_keyword` for SP label names
15284 * `role_keyword` for role names
15285 * `lvalue_keyword` for variable prefixes and names in left sides of
15286 assignments in SET statements
15287
15288 Normally, new non-reserved words should be added to the
15289 the rule `ident_keywords_unambiguous`. If they cause grammar conflicts, try
15290 one of `ident_keywords_ambiguous_...` rules instead.
15291 */
15292 ident_keyword:
15293 ident_keywords_unambiguous
15294 | ident_keywords_ambiguous_1_roles_and_labels
15295 | ident_keywords_ambiguous_2_labels
15296 | ident_keywords_ambiguous_3_roles
15297 | ident_keywords_ambiguous_4_system_variables
15298 ;
15299
15300 /*
15301 These non-reserved words cannot be used as role names and SP label names:
15302 */
15303 ident_keywords_ambiguous_1_roles_and_labels:
15304 EXECUTE_SYM
15305 | RESTART_SYM
15306 | SHUTDOWN
15307 ;
15308
15309 /*
15310 These non-reserved keywords cannot be used as unquoted SP label names:
15311 */
15312 ident_keywords_ambiguous_2_labels:
15313 ASCII_SYM
15314 | BEGIN_SYM
15315 | BYTE_SYM
15316 | CACHE_SYM
15317 | CHARSET
15318 | CHECKSUM_SYM
15319 | CLONE_SYM
15320 | COMMENT_SYM
15321 | COMMIT_SYM
15322 | COMPRESSION_DICTIONARY_SYM
15323 | CONTAINS_SYM
15324 | DEALLOCATE_SYM
15325 | DO_SYM
15326 | END
15327 | FLUSH_SYM
15328 | FOLLOWS_SYM
15329 | HANDLER_SYM
15330 | HELP_SYM
15331 | IMPORT
15332 | INSTALL_SYM
15333 | LANGUAGE_SYM
15334 | NO_SYM
15335 | PRECEDES_SYM
15336 | PREPARE_SYM
15337 | REPAIR
15338 | RESET_SYM
15339 | ROLLBACK_SYM
15340 | SAVEPOINT_SYM
15341 | SIGNED_SYM
15342 | SLAVE
15343 | START_SYM
15344 | STOP_SYM
15345 | TRUNCATE_SYM
15346 | UNICODE_SYM
15347 | UNINSTALL_SYM
15348 | XA_SYM
15349 ;
15350
15351 /*
15352 Keywords that we allow for labels in SPs in the unquoted form.
15353 Any keyword that is allowed to begin a statement or routine characteristics
15354 must be in `ident_keywords_ambiguous_2_labels` above, otherwise
15355 we get (harmful) shift/reduce conflicts.
15356
15357 Not allowed:
15358
15359 ident_keywords_ambiguous_1_roles_and_labels
15360 ident_keywords_ambiguous_2_labels
15361 */
15362 label_keyword:
15363 ident_keywords_unambiguous
15364 | ident_keywords_ambiguous_3_roles
15365 | ident_keywords_ambiguous_4_system_variables
15366 ;
15367
15368 /*
15369 These non-reserved keywords cannot be used as unquoted role names:
15370 */
15371 ident_keywords_ambiguous_3_roles:
15372 EVENT_SYM
15373 | FILE_SYM
15374 | NONE_SYM
15375 | PROCESS
15376 | PROXY_SYM
15377 | RELOAD
15378 | REPLICATION
15379 | RESOURCE_SYM
15380 | SUPER_SYM
15381 ;
15382
15383 /*
15384 These are the non-reserved keywords which may be used for unquoted
15385 identifiers everywhere without introducing grammar conflicts:
15386 */
15387 ident_keywords_unambiguous:
15388 ACTION
15389 | ACCOUNT_SYM
15390 | ACTIVE_SYM
15391 | ADDDATE_SYM
15392 | ADMIN_SYM
15393 | AFTER_SYM
15394 | AGAINST
15395 | AGGREGATE_SYM
15396 | ALGORITHM_SYM
15397 | ALWAYS_SYM
15398 | ANY_SYM
15399 | ARRAY_SYM
15400 | AT_SYM
15401 | ATTRIBUTE_SYM
15402 | AUTHENTICATION_SYM
15403 | AUTOEXTEND_SIZE_SYM
15404 | AUTO_INC
15405 | AVG_ROW_LENGTH
15406 | AVG_SYM
15407 | BACKUP_SYM
15408 | BINLOG_SYM
15409 | BIT_SYM %prec KEYWORD_USED_AS_IDENT
15410 | BLOCK_SYM
15411 | BOOLEAN_SYM
15412 | BOOL_SYM
15413 | BTREE_SYM
15414 | BUCKETS_SYM
15415 | CASCADED
15416 | CATALOG_NAME_SYM
15417 | CHAIN_SYM
15418 | CHALLENGE_RESPONSE_SYM
15419 | CHANGED
15420 | CHANNEL_SYM
15421 | CIPHER_SYM
15422 | CLASS_ORIGIN_SYM
15423 | CLIENT_SYM
15424 | CLIENT_STATS_SYM
15425 | CLOSE_SYM
15426 | COALESCE
15427 | CODE_SYM
15428 | COLLATION_SYM
15429 | COLUMNS
15430 | COLUMN_FORMAT_SYM
15431 | COLUMN_NAME_SYM
15432 | COMMITTED_SYM
15433 | COMPACT_SYM
15434 | COMPLETION_SYM
15435 | COMPONENT_SYM
15436 | COMPRESSED_SYM
15437 | COMPRESSION_SYM
15438 | CONCURRENT
15439 | CONNECTION_SYM
15440 | CONSISTENT_SYM
15441 | CONSTRAINT_CATALOG_SYM
15442 | CONSTRAINT_NAME_SYM
15443 | CONSTRAINT_SCHEMA_SYM
15444 | CONTEXT_SYM
15445 | CPU_SYM
15446 | CURRENT_SYM /* not reserved in MySQL per WL#2111 specification */
15447 | CURSOR_NAME_SYM
15448 | DATAFILE_SYM
15449 | DATA_SYM
15450 | DATETIME_SYM
15451 | DATE_SYM %prec KEYWORD_USED_AS_IDENT
15452 | DAY_SYM
15453 | DEFAULT_AUTH_SYM
15454 | DEFINER_SYM
15455 | DEFINITION_SYM
15456 | DELAY_KEY_WRITE_SYM
15457 | DESCRIPTION_SYM
15458 | DIAGNOSTICS_SYM
15459 | DIRECTORY_SYM
15460 | DISABLE_SYM
15461 | DISCARD_SYM
15462 | DISK_SYM
15463 | DUMPFILE
15464 | DUPLICATE_SYM
15465 | DYNAMIC_SYM
15466 | EFFECTIVE_SYM
15467 | ENABLE_SYM
15468 | ENCRYPTION_KEY_ID_SYM
15469 | ENCRYPTION_SYM
15470 | ENDS_SYM
15471 | ENFORCED_SYM
15472 | ENGINES_SYM
15473 | ENGINE_SYM
15474 | ENGINE_ATTRIBUTE_SYM
15475 | ENUM_SYM
15476 | ERRORS
15477 | ERROR_SYM
15478 | ESCAPE_SYM
15479 | EVENTS_SYM
15480 | EVERY_SYM
15481 | EXCHANGE_SYM
15482 | EXCLUDE_SYM
15483 | EXPANSION_SYM
15484 | EXPIRE_SYM
15485 | EXPORT_SYM
15486 | EXTENDED_SYM
15487 | EXTENT_SIZE_SYM
15488 | FACTOR_SYM
15489 | FAILED_LOGIN_ATTEMPTS_SYM
15490 | FAST_SYM
15491 | FAULTS_SYM
15492 | FILE_BLOCK_SIZE_SYM
15493 | FILTER_SYM
15494 | FINISH_SYM
15495 | FIRST_SYM
15496 | FIXED_SYM
15497 | FOLLOWING_SYM
15498 | FORMAT_SYM
15499 | FOUND_SYM
15500 | FULL
15501 | GENERAL
15502 | GEOMETRYCOLLECTION_SYM
15503 | GEOMETRY_SYM
15504 | GET_FORMAT
15505 | GET_MASTER_PUBLIC_KEY_SYM
15506 | GET_SOURCE_PUBLIC_KEY_SYM
15507 | GRANTS
15508 | GROUP_REPLICATION
15509 | GTID_ONLY_SYM
15510 | HASH_SYM
15511 | HISTOGRAM_SYM
15512 | HISTORY_SYM
15513 | HOSTS_SYM
15514 | HOST_SYM
15515 | HOUR_SYM
15516 | IDENTIFIED_SYM
15517 | IGNORE_SERVER_IDS_SYM
15518 | INACTIVE_SYM
15519 | INDEX_STATS_SYM
15520 | INDEXES
15521 | INITIAL_SIZE_SYM
15522 | INITIAL_SYM
15523 | INITIATE_SYM
15524 | INSERT_METHOD
15525 | INSTANCE_SYM
15526 | INVISIBLE_SYM
15527 | INVOKER_SYM
15528 | IO_SYM
15529 | IPC_SYM
15530 | ISOLATION
15531 | ISSUER_SYM
15532 | JSON_SYM
15533 | JSON_VALUE_SYM
15534 | KEY_BLOCK_SIZE
15535 | KEYRING_SYM
15536 | LAST_SYM
15537 | LEAVES
15538 | LESS_SYM
15539 | LEVEL_SYM
15540 | LINESTRING_SYM
15541 | LIST_SYM
15542 | LOCKED_SYM
15543 | LOCKS_SYM
15544 | LOGFILE_SYM
15545 | LOGS_SYM
15546 | MASTER_AUTO_POSITION_SYM
15547 | MASTER_COMPRESSION_ALGORITHM_SYM
15548 | MASTER_CONNECT_RETRY_SYM
15549 | MASTER_DELAY_SYM
15550 | MASTER_HEARTBEAT_PERIOD_SYM
15551 | MASTER_HOST_SYM
15552 | NETWORK_NAMESPACE_SYM
15553 | MASTER_LOG_FILE_SYM
15554 | MASTER_LOG_POS_SYM
15555 | MASTER_PASSWORD_SYM
15556 | MASTER_PORT_SYM
15557 | MASTER_PUBLIC_KEY_PATH_SYM
15558 | MASTER_RETRY_COUNT_SYM
15559 | MASTER_SSL_CAPATH_SYM
15560 | MASTER_SSL_CA_SYM
15561 | MASTER_SSL_CERT_SYM
15562 | MASTER_SSL_CIPHER_SYM
15563 | MASTER_SSL_CRLPATH_SYM
15564 | MASTER_SSL_CRL_SYM
15565 | MASTER_SSL_KEY_SYM
15566 | MASTER_SSL_SYM
15567 | MASTER_SYM
15568 | MASTER_TLS_CIPHERSUITES_SYM
15569 | MASTER_TLS_VERSION_SYM
15570 | MASTER_USER_SYM
15571 | MASTER_ZSTD_COMPRESSION_LEVEL_SYM
15572 | MAX_CONNECTIONS_PER_HOUR
15573 | MAX_QUERIES_PER_HOUR
15574 | MAX_ROWS
15575 | MAX_SIZE_SYM
15576 | MAX_UPDATES_PER_HOUR
15577 | MAX_USER_CONNECTIONS_SYM
15578 | MEDIUM_SYM
15579 | MEMBER_SYM
15580 | MEMORY_SYM
15581 | MERGE_SYM
15582 | MESSAGE_TEXT_SYM
15583 | MICROSECOND_SYM
15584 | MIGRATE_SYM
15585 | MINUTE_SYM
15586 | MIN_ROWS
15587 | MODE_SYM
15588 | MODIFY_SYM
15589 | MONTH_SYM
15590 | MULTILINESTRING_SYM
15591 | MULTIPOINT_SYM
15592 | MULTIPOLYGON_SYM
15593 | MUTEX_SYM
15594 | MYSQL_ERRNO_SYM
15595 | NAMES_SYM %prec KEYWORD_USED_AS_IDENT
15596 | NAME_SYM
15597 | NATIONAL_SYM
15598 | NCHAR_SYM
15599 | NDBCLUSTER_SYM
15600 | NESTED_SYM
15601 | NEVER_SYM
15602 | NEW_SYM
15603 | NEXT_SYM
15604 | NODEGROUP_SYM
15605 | NOWAIT_SYM
15606 | NO_WAIT_SYM
15607 | NULLS_SYM
15608 | NUMBER_SYM
15609 | NVARCHAR_SYM
15610 | OFF_SYM
15611 | OFFSET_SYM
15612 | OJ_SYM
15613 | OLD_SYM
15614 | ONE_SYM
15615 | ONLY_SYM
15616 | OPEN_SYM
15617 | OPTIONAL_SYM
15618 | OPTIONS_SYM
15619 | ORDINALITY_SYM
15620 | ORGANIZATION_SYM
15621 | OTHERS_SYM
15622 | OWNER_SYM
15623 | PACK_KEYS_SYM
15624 | PAGE_SYM
15625 | PARSER_SYM
15626 | PARTIAL
15627 | PARTITIONING_SYM
15628 | PARTITIONS_SYM
15629 | PASSWORD %prec KEYWORD_USED_AS_IDENT
15630 | PASSWORD_LOCK_TIME_SYM
15631 | PATH_SYM
15632 | PHASE_SYM
15633 | PLUGINS_SYM
15634 | PLUGIN_DIR_SYM
15635 | PLUGIN_SYM
15636 | POINT_SYM
15637 | POLYGON_SYM
15638 | PORT_SYM
15639 | PRECEDING_SYM
15640 | PRESERVE_SYM
15641 | PREV_SYM
15642 | PRIVILEGES
15643 | PRIVILEGE_CHECKS_USER_SYM
15644 | PROCESSLIST_SYM
15645 | PROFILES_SYM
15646 | PROFILE_SYM
15647 | QUARTER_SYM
15648 | QUERY_SYM
15649 | QUICK
15650 | RANDOM_SYM
15651 | READ_ONLY_SYM
15652 | REBUILD_SYM
15653 | RECOVER_SYM
15654 | REDO_BUFFER_SIZE_SYM
15655 | REDUNDANT_SYM
15656 | REFERENCE_SYM
15657 | REGISTRATION_SYM
15658 | RELAY
15659 | RELAYLOG_SYM
15660 | RELAY_LOG_FILE_SYM
15661 | RELAY_LOG_POS_SYM
15662 | RELAY_THREAD
15663 | REMOVE_SYM
15664 | ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS_SYM
15665 | REORGANIZE_SYM
15666 | REPEATABLE_SYM
15667 | REPLICAS_SYM
15668 | REPLICATE_DO_DB
15669 | REPLICATE_DO_TABLE
15670 | REPLICATE_IGNORE_DB
15671 | REPLICATE_IGNORE_TABLE
15672 | REPLICATE_REWRITE_DB
15673 | REPLICATE_WILD_DO_TABLE
15674 | REPLICATE_WILD_IGNORE_TABLE
15675 | REPLICA_SYM
15676 | REQUIRE_ROW_FORMAT_SYM
15677 | REQUIRE_TABLE_PRIMARY_KEY_CHECK_SYM
15678 | RESOURCES
15679 | RESPECT_SYM
15680 | RESTORE_SYM
15681 | RESUME_SYM
15682 | RETAIN_SYM
15683 | RETURNED_SQLSTATE_SYM
15684 | RETURNING_SYM
15685 | RETURNS_SYM
15686 | REUSE_SYM
15687 | REVERSE_SYM
15688 | ROLE_SYM
15689 | ROLLUP_SYM
15690 | ROTATE_SYM
15691 | ROUTINE_SYM
15692 | ROW_COUNT_SYM
15693 | ROW_FORMAT_SYM
15694 | RTREE_SYM
15695 | SCHEDULE_SYM
15696 | SCHEMA_NAME_SYM
15697 | SECONDARY_ENGINE_SYM
15698 | SECONDARY_ENGINE_ATTRIBUTE_SYM
15699 | SECONDARY_LOAD_SYM
15700 | SECONDARY_SYM
15701 | SECONDARY_UNLOAD_SYM
15702 | SECOND_SYM
15703 | SECURITY_SYM
15704 | SERIALIZABLE_SYM
15705 | SERIAL_SYM
15706 | SERVER_SYM
15707 | SHARE_SYM
15708 | SIMPLE_SYM
15709 | SKIP_SYM
15710 | SLOW
15711 | SNAPSHOT_SYM
15712 | SOCKET_SYM
15713 | SONAME_SYM
15714 | SOUNDS_SYM
15715 | SOURCE_AUTO_POSITION_SYM
15716 | SOURCE_BIND_SYM
15717 | SOURCE_COMPRESSION_ALGORITHM_SYM
15718 | SOURCE_CONNECTION_AUTO_FAILOVER_SYM
15719 | SOURCE_CONNECT_RETRY_SYM
15720 | SOURCE_DELAY_SYM
15721 | SOURCE_HEARTBEAT_PERIOD_SYM
15722 | SOURCE_HOST_SYM
15723 | SOURCE_LOG_FILE_SYM
15724 | SOURCE_LOG_POS_SYM
15725 | SOURCE_PASSWORD_SYM
15726 | SOURCE_PORT_SYM
15727 | SOURCE_PUBLIC_KEY_PATH_SYM
15728 | SOURCE_RETRY_COUNT_SYM
15729 | SOURCE_SSL_CAPATH_SYM
15730 | SOURCE_SSL_CA_SYM
15731 | SOURCE_SSL_CERT_SYM
15732 | SOURCE_SSL_CIPHER_SYM
15733 | SOURCE_SSL_CRLPATH_SYM
15734 | SOURCE_SSL_CRL_SYM
15735 | SOURCE_SSL_KEY_SYM
15736 | SOURCE_SSL_SYM
15737 | SOURCE_SSL_VERIFY_SERVER_CERT_SYM
15738 | SOURCE_SYM
15739 | SOURCE_TLS_CIPHERSUITES_SYM
15740 | SOURCE_TLS_VERSION_SYM
15741 | SOURCE_USER_SYM
15742 | SOURCE_ZSTD_COMPRESSION_LEVEL_SYM
15743 | SQL_AFTER_GTIDS
15744 | SQL_AFTER_MTS_GAPS
15745 | SQL_BEFORE_GTIDS
15746 | SQL_BUFFER_RESULT
15747 | SQL_NO_CACHE_SYM
15748 | SQL_THREAD
15749 | SRID_SYM
15750 | STACKED_SYM
15751 | STARTS_SYM
15752 | STATS_AUTO_RECALC_SYM
15753 | STATS_PERSISTENT_SYM
15754 | STATS_SAMPLE_PAGES_SYM
15755 | STATUS_SYM
15756 | STORAGE_SYM
15757 | STREAM_SYM
15758 | STRING_SYM
15759 | ST_COLLECT_SYM
15760 | SUBCLASS_ORIGIN_SYM
15761 | SUBDATE_SYM
15762 | SUBJECT_SYM
15763 | SUBPARTITIONS_SYM
15764 | SUBPARTITION_SYM
15765 | SUSPEND_SYM
15766 | SWAPS_SYM
15767 | SWITCHES_SYM
15768 | TABLES
15769 | TABLESPACE_SYM
15770 | TABLE_CHECKSUM_SYM
15771 | TABLE_NAME_SYM
15772 | TABLE_STATS_SYM
15773 | TEMPORARY
15774 | TEMPTABLE_SYM
15775 | TEXT_SYM
15776 | THAN_SYM
15777 | THREAD_PRIORITY_SYM
15778 | THREAD_STATS_SYM
15779 | TIES_SYM
15780 | TIMESTAMP_ADD
15781 | TIMESTAMP_DIFF
15782 | TIMESTAMP_SYM %prec KEYWORD_USED_AS_IDENT
15783 | TIME_SYM %prec KEYWORD_USED_AS_IDENT
15784 | TLS_SYM
15785 | TRANSACTION_SYM
15786 | TRIGGERS_SYM
15787 | TYPES_SYM
15788 | TYPE_SYM
15789 | UNBOUNDED_SYM
15790 | UNCOMMITTED_SYM
15791 | UNDEFINED_SYM
15792 | UNDOFILE_SYM
15793 | UNDO_BUFFER_SIZE_SYM
15794 | UNKNOWN_SYM
15795 | UNREGISTER_SYM
15796 | UNTIL_SYM
15797 | UPGRADE_SYM
15798 | USER
15799 | USER_STATS_SYM
15800 | USE_FRM
15801 | VALIDATION_SYM
15802 | VALUE_SYM
15803 | VARIABLES
15804 | VCPU_SYM
15805 | VIEW_SYM
15806 | VISIBLE_SYM
15807 | WAIT_SYM
15808 | WARNINGS
15809 | WEEK_SYM
15810 | WEIGHT_STRING_SYM
15811 | WITHOUT_SYM
15812 | WORK_SYM
15813 | WRAPPER_SYM
15814 | X509_SYM
15815 | XID_SYM
15816 | XML_SYM
15817 | YEAR_SYM
15818 | ZONE_SYM
15819 ;
15820
15821 /*
15822 Non-reserved keywords that we allow for unquoted role names:
15823
15824 Not allowed:
15825
15826 ident_keywords_ambiguous_1_roles_and_labels
15827 ident_keywords_ambiguous_3_roles
15828 */
15829 role_keyword:
15830 ident_keywords_unambiguous
15831 | ident_keywords_ambiguous_2_labels
15832 | ident_keywords_ambiguous_4_system_variables
15833 ;
15834
15835 /*
15836 Non-reserved words allowed for unquoted unprefixed variable names and
15837 unquoted variable prefixes in the left side of assignments in SET statements:
15838
15839 Not allowed:
15840
15841 ident_keywords_ambiguous_4_system_variables
15842 */
15843 lvalue_keyword:
15844 ident_keywords_unambiguous
15845 | ident_keywords_ambiguous_1_roles_and_labels
15846 | ident_keywords_ambiguous_2_labels
15847 | ident_keywords_ambiguous_3_roles
15848 ;
15849
15850 /*
15851 These non-reserved keywords cannot be used as unquoted unprefixed
15852 variable names and unquoted variable prefixes in the left side of
15853 assignments in SET statements:
15854 */
15855 ident_keywords_ambiguous_4_system_variables:
15856 GLOBAL_SYM
15857 | LOCAL_SYM
15858 | PERSIST_SYM
15859 | PERSIST_ONLY_SYM
15860 | SESSION_SYM
15861 ;
15862
15863 /*
15864 SQLCOM_SET_OPTION statement.
15865
15866 Note that to avoid shift/reduce conflicts, we have separate rules for the
15867 first option listed in the statement.
15868 */
15869
15870 set:
15871 SET_SYM start_option_value_list
15872 {
15873
2/4
✓ Branch 0 taken 1432307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1432314 times.
✗ Branch 3 not taken.
1432293 $$= NEW_PTN PT_set(@1, $2);
15874 }
15875 ;
15876
15877
15878 // Start of option value list
15879 start_option_value_list:
15880 option_value_no_option_type option_value_list_continued
15881 {
15882
2/4
✓ Branch 0 taken 1065176 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1065186 times.
✗ Branch 3 not taken.
1065158 $$= NEW_PTN PT_start_option_value_list_no_type($1, @1, $2);
15883 }
15884 | TRANSACTION_SYM transaction_characteristics
15885 {
15886
2/4
✓ Branch 0 taken 2889 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2889 times.
✗ Branch 3 not taken.
2889 $$= NEW_PTN PT_start_option_value_list_transaction($2, @2);
15887 }
15888 | option_type start_option_value_list_following_option_type
15889 {
15890
2/4
✓ Branch 0 taken 363351 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 363352 times.
✗ Branch 3 not taken.
363350 $$= NEW_PTN PT_start_option_value_list_type($1, $2);
15891 }
15892 | PASSWORD equal TEXT_STRING_password opt_replace_password opt_retain_current_password
15893 {
15894
1/2
✓ Branch 0 taken 220 times.
✗ Branch 1 not taken.
440 $$= NEW_PTN PT_option_value_no_option_type_password($3.str, $4.str,
15895 220 $5,
15896 false,
15897
1/2
✓ Branch 0 taken 220 times.
✗ Branch 1 not taken.
440 @4);
15898 }
15899 | PASSWORD TO_SYM RANDOM_SYM opt_replace_password opt_retain_current_password
15900 {
15901 // RANDOM PASSWORD GENERATION AND RETURN RESULT SET...
15902
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
14 $$= NEW_PTN PT_option_value_no_option_type_password($3.str, $4.str,
15903 7 $5,
15904 true,
15905
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
14 @4);
15906 }
15907 | PASSWORD FOR_SYM user equal TEXT_STRING_password opt_replace_password opt_retain_current_password
15908 {
15909
1/2
✓ Branch 0 taken 614 times.
✗ Branch 1 not taken.
1228 $$= NEW_PTN PT_option_value_no_option_type_password_for($3, $5.str,
15910 614 $6.str,
15911 614 $7,
15912 false,
15913
1/2
✓ Branch 0 taken 614 times.
✗ Branch 1 not taken.
1228 @6);
15914 }
15915 | PASSWORD FOR_SYM user TO_SYM RANDOM_SYM opt_replace_password opt_retain_current_password
15916 {
15917 // RANDOM PASSWORD GENERATION AND RETURN RESULT SET...
15918
1/2
✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
100 $$= NEW_PTN PT_option_value_no_option_type_password_for($3, $5.str,
15919 50 $6.str,
15920 50 $7,
15921 true,
15922
1/2
✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
100 @6);
15923 }
15924 ;
15925
15926 set_role_stmt:
15927 SET_SYM ROLE_SYM role_list
15928 {
15929
1/2
✓ Branch 0 taken 187 times.
✗ Branch 1 not taken.
187 $$= NEW_PTN PT_set_role($3);
15930 }
15931 | SET_SYM ROLE_SYM NONE_SYM
15932 {
15933
1/2
✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
38 $$= NEW_PTN PT_set_role(role_enum::ROLE_NONE);
15934 38 Lex->sql_command= SQLCOM_SET_ROLE;
15935 }
15936 | SET_SYM ROLE_SYM DEFAULT_SYM
15937 {
15938
1/2
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
21 $$= NEW_PTN PT_set_role(role_enum::ROLE_DEFAULT);
15939 21 Lex->sql_command= SQLCOM_SET_ROLE;
15940 }
15941 | SET_SYM DEFAULT_SYM ROLE_SYM role_list TO_SYM role_list
15942 {
15943
1/2
✓ Branch 0 taken 212 times.
✗ Branch 1 not taken.
424 $$= NEW_PTN PT_alter_user_default_role(false, $6, $4,
15944 424 role_enum::ROLE_NAME);
15945 }
15946 | SET_SYM DEFAULT_SYM ROLE_SYM NONE_SYM TO_SYM role_list
15947 {
15948
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
32 $$= NEW_PTN PT_alter_user_default_role(false, $6, NULL,
15949 32 role_enum::ROLE_NONE);
15950 }
15951 | SET_SYM DEFAULT_SYM ROLE_SYM ALL TO_SYM role_list
15952 {
15953
1/2
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
24 $$= NEW_PTN PT_alter_user_default_role(false, $6, NULL,
15954 24 role_enum::ROLE_ALL);
15955 }
15956 | SET_SYM ROLE_SYM ALL opt_except_role_list
15957 {
15958
1/2
✓ Branch 0 taken 70 times.
✗ Branch 1 not taken.
70 $$= NEW_PTN PT_set_role(role_enum::ROLE_ALL, $4);
15959 70 Lex->sql_command= SQLCOM_SET_ROLE;
15960 }
15961 ;
15962
15963 opt_except_role_list:
15964 87 /* empty */ { $$= NULL; }
15965 30 | EXCEPT_SYM role_list { $$= $2; }
15966 ;
15967
15968 set_resource_group_stmt:
15969 SET_SYM RESOURCE_SYM GROUP_SYM ident
15970 {
15971
1/2
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
18 $$= NEW_PTN PT_set_resource_group(to_lex_cstring($4), nullptr);
15972 }
15973 | SET_SYM RESOURCE_SYM GROUP_SYM ident FOR_SYM thread_id_list_options
15974 {
15975
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 $$= NEW_PTN PT_set_resource_group(to_lex_cstring($4), $6);
15976 }
15977 ;
15978
15979 thread_id_list:
15980 real_ulong_num
15981 {
15982
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 $$= NEW_PTN Mem_root_array<ulonglong>(YYMEM_ROOT);
15983
4/8
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
4 if ($$ == nullptr || $$->push_back($1))
15984 MYSQL_YYABORT; // OOM
15985 }
15986 | thread_id_list opt_comma real_ulong_num
15987 {
15988 1 $$= $1;
15989
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if ($$->push_back($3))
15990 MYSQL_YYABORT; // OOM
15991 }
15992 ;
15993
15994 thread_id_list_options:
15995 4 thread_id_list { $$= $1; }
15996 ;
15997
15998 // Start of option value list, option_type was given
15999 start_option_value_list_following_option_type:
16000 option_value_following_option_type option_value_list_continued
16001 {
16002 349312 $$=
16003
1/2
✓ Branch 0 taken 349311 times.
✗ Branch 1 not taken.
698623 NEW_PTN PT_start_option_value_list_following_option_type_eq($1,
16004 349311 @1,
16005
1/2
✓ Branch 0 taken 349312 times.
✗ Branch 1 not taken.
698622 $2);
16006 }
16007 | TRANSACTION_SYM transaction_characteristics
16008 {
16009
1/2
✓ Branch 0 taken 14039 times.
✗ Branch 1 not taken.
28078 $$= NEW_PTN
16010 PT_start_option_value_list_following_option_type_transaction($2,
16011
1/2
✓ Branch 0 taken 14039 times.
✗ Branch 1 not taken.
28078 @2);
16012 }
16013 ;
16014
16015 // Remainder of the option value list after first option value.
16016 option_value_list_continued:
16017 1376936 /* empty */ { $$= NULL; }
16018 37522 | ',' option_value_list { $$= $2; }
16019 ;
16020
16021 // Repeating list of option values after first option value.
16022 option_value_list:
16023 option_value
16024 {
16025
2/4
✓ Branch 0 taken 37521 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37521 times.
✗ Branch 3 not taken.
37521 $$= NEW_PTN PT_option_value_list_head(@0, $1, @1);
16026 }
16027 | option_value_list ',' option_value
16028 {
16029
2/4
✓ Branch 0 taken 11799 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11799 times.
✗ Branch 3 not taken.
11799 $$= NEW_PTN PT_option_value_list($1, @2, $3, @3);
16030 }
16031 ;
16032
16033 // Wrapper around option values following the first option value in the stmt.
16034 option_value:
16035 option_type option_value_following_option_type
16036 {
16037
2/4
✓ Branch 0 taken 531 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 531 times.
✗ Branch 3 not taken.
531 $$= NEW_PTN PT_option_value_type($1, $2);
16038 }
16039 48789 | option_value_no_option_type { $$= $1; }
16040 ;
16041
16042 option_type:
16043 211880 GLOBAL_SYM { $$=OPT_GLOBAL; }
16044 3242 | PERSIST_SYM { $$=OPT_PERSIST; }
16045 1522 | PERSIST_ONLY_SYM { $$=OPT_PERSIST_ONLY; }
16046 443 | LOCAL_SYM { $$=OPT_SESSION; }
16047 146804 | SESSION_SYM { $$=OPT_SESSION; }
16048 ;
16049
16050 opt_var_type:
16051 77528 /* empty */ { $$=OPT_SESSION; }
16052 36750 | GLOBAL_SYM { $$=OPT_GLOBAL; }
16053 20 | LOCAL_SYM { $$=OPT_SESSION; }
16054 22535 | SESSION_SYM { $$=OPT_SESSION; }
16055 ;
16056
16057 opt_rvalue_system_variable_type:
16058 339110 /* empty */ { $$=OPT_DEFAULT; }
16059 282381 | GLOBAL_SYM '.' { $$=OPT_GLOBAL; }
16060 498 | LOCAL_SYM '.' { $$=OPT_SESSION; }
16061 49840 | SESSION_SYM '.' { $$=OPT_SESSION; }
16062 ;
16063
16064 opt_set_var_ident_type:
16065 82505 /* empty */ { $$=OPT_DEFAULT; }
16066 140 | PERSIST_SYM '.' { $$=OPT_PERSIST; }
16067 252 | PERSIST_ONLY_SYM '.' {$$=OPT_PERSIST_ONLY; }
16068 29902 | GLOBAL_SYM '.' { $$=OPT_GLOBAL; }
16069 262 | LOCAL_SYM '.' { $$=OPT_SESSION; }
16070 88616 | SESSION_SYM '.' { $$=OPT_SESSION; }
16071 ;
16072
16073 // Option values with preceding option_type.
16074 option_value_following_option_type:
16075 lvalue_variable equal set_expr_or_default
16076 {
16077 349844 $$ = NEW_PTN PT_set_scoped_system_variable(
16078
2/4
✓ Branch 0 taken 349844 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 349844 times.
✗ Branch 3 not taken.
349842 @1, $1.prefix, $1.name, $3);
16079 }
16080 ;
16081
16082 // Option values without preceding option_type.
16083 option_value_no_option_type:
16084 lvalue_variable equal set_expr_or_default
16085 {
16086
2/4
✓ Branch 0 taken 390436 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 390441 times.
✗ Branch 3 not taken.
390428 $$ = NEW_PTN PT_set_variable(@1, $1.prefix, $1.name, @3, $3);
16087 }
16088 | '@' ident_or_text equal expr
16089 {
16090
2/4
✓ Branch 0 taken 506933 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 506933 times.
✗ Branch 3 not taken.
506933 $$= NEW_PTN PT_option_value_no_option_type_user_var($2, $4);
16091 }
16092 | '@' '@' opt_set_var_ident_type lvalue_variable equal
16093 set_expr_or_default
16094 {
16095
1/2
✓ Branch 0 taken 201635 times.
✗ Branch 1 not taken.
403265 $$ = NEW_PTN PT_set_system_variable(
16096
1/2
✓ Branch 0 taken 201630 times.
✗ Branch 1 not taken.
403275 $3, @4, $4.prefix, $4.name, $6);
16097 }
16098 | character_set old_or_new_charset_name_or_default
16099 {
16100
2/4
✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 40 times.
✗ Branch 3 not taken.
40 $$= NEW_PTN PT_option_value_no_option_type_charset($2);
16101 }
16102 | NAMES_SYM equal expr
16103 {
16104 /*
16105 Bad syntax, always fails with an error
16106 */
16107
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 $$= NEW_PTN PT_option_value_no_option_type_names(@2);
16108 }
16109 | NAMES_SYM charset_name opt_collate
16110 {
16111
2/4
✓ Branch 0 taken 14819 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14818 times.
✗ Branch 3 not taken.
14818 $$= NEW_PTN PT_set_names($2, $3);
16112 }
16113 | NAMES_SYM DEFAULT_SYM
16114 {
16115
2/4
✓ Branch 0 taken 97 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 97 times.
✗ Branch 3 not taken.
97 $$ = NEW_PTN PT_set_names(nullptr, nullptr);
16116 }
16117 ;
16118
16119 lvalue_variable:
16120 lvalue_ident
16121 {
16122 934097 $$ = Bipartite_name{{}, to_lex_cstring($1)};
16123 }
16124 | lvalue_ident '.' ident
16125 {
16126 /*
16127 Reject names prefixed by `GLOBAL.`, `LOCAL.`, or `SESSION.` --
16128 if one of those prefixes is there then we are parsing something
16129 like `GLOBAL.GLOBAL.foo` or `LOCAL.SESSION.bar` etc.
16130 */
16131
3/4
✓ Branch 0 taken 7974 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 111 times.
✓ Branch 3 taken 7863 times.
7974 if (check_reserved_words($1.str)) {
16132
1/2
✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
111 YYTHD->syntax_error_at(@1);
16133 111 MYSQL_YYABORT;
16134 }
16135 7863 $$ = Bipartite_name{to_lex_cstring($1), to_lex_cstring($3)};
16136 }
16137 | DEFAULT_SYM '.' ident
16138 {
16139 $$ = Bipartite_name{{STRING_WITH_LEN("default")}, to_lex_cstring($3)};
16140 }
16141 ;
16142
16143 rvalue_system_variable:
16144 ident_or_text
16145 {
16146 671568 $$ = Bipartite_name{{}, to_lex_cstring($1)};
16147 }
16148 | ident_or_text '.' ident
16149 {
16150 // disallow "SELECT @@global.global.variable"
16151
2/4
✓ Branch 0 taken 259 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 259 times.
259 if (check_reserved_words($1.str)) {
16152 YYTHD->syntax_error_at(@1);
16153 MYSQL_YYABORT;
16154 }
16155 259 $$ = Bipartite_name{to_lex_cstring($1), to_lex_cstring($3)};
16156 }
16157 ;
16158
16159 transaction_characteristics:
16160 transaction_access_mode opt_isolation_level
16161 {
16162
2/4
✓ Branch 0 taken 13227 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13227 times.
✗ Branch 3 not taken.
13227 $$= NEW_PTN PT_transaction_characteristics($1, $2);
16163 }
16164 | isolation_level opt_transaction_access_mode
16165 {
16166
2/4
✓ Branch 0 taken 3701 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3701 times.
✗ Branch 3 not taken.
3701 $$= NEW_PTN PT_transaction_characteristics($1, $2);
16167 }
16168 ;
16169
16170 transaction_access_mode:
16171 transaction_access_mode_types
16172 {
16173
2/4
✓ Branch 0 taken 13235 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13235 times.
✗ Branch 3 not taken.
13235 $$= NEW_PTN PT_transaction_access_mode($1);
16174 }
16175 ;
16176
16177 opt_transaction_access_mode:
16178 3694 /* empty */ { $$= NULL; }
16179 7 | ',' transaction_access_mode { $$= $2; }
16180 ;
16181
16182 isolation_level:
16183 ISOLATION LEVEL_SYM isolation_types
16184 {
16185
2/4
✓ Branch 0 taken 3708 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3708 times.
✗ Branch 3 not taken.
3708 $$= NEW_PTN PT_isolation_level($3);
16186 }
16187 ;
16188
16189 opt_isolation_level:
16190 13220 /* empty */ { $$= NULL; }
16191 7 | ',' isolation_level { $$= $2; }
16192 ;
16193
16194 transaction_access_mode_types:
16195 45 READ_SYM ONLY_SYM { $$= true; }
16196 13190 | READ_SYM WRITE_SYM { $$= false; }
16197 ;
16198
16199 isolation_types:
16200 125 READ_SYM UNCOMMITTED_SYM { $$= ISO_READ_UNCOMMITTED; }
16201 3025 | READ_SYM COMMITTED_SYM { $$= ISO_READ_COMMITTED; }
16202 359 | REPEATABLE_SYM READ_SYM { $$= ISO_REPEATABLE_READ; }
16203 199 | SERIALIZABLE_SYM { $$= ISO_SERIALIZABLE; }
16204 ;
16205
16206 set_expr_or_default:
16207 expr
16208 73859 | DEFAULT_SYM { $$= NULL; }
16209 | ON_SYM
16210 {
16211
2/4
✓ Branch 0 taken 3613 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3613 times.
✗ Branch 3 not taken.
3613 $$= NEW_PTN Item_string(@$, "ON", 2, system_charset_info);
16212 }
16213 | ALL
16214 {
16215
2/4
✓ Branch 0 taken 103 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 103 times.
✗ Branch 3 not taken.
103 $$= NEW_PTN Item_string(@$, "ALL", 3, system_charset_info);
16216 }
16217 | BINARY_SYM
16218 {
16219
2/4
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48 times.
✗ Branch 3 not taken.
48 $$= NEW_PTN Item_string(@$, "binary", 6, system_charset_info);
16220 }
16221 | ROW_SYM
16222 {
16223
2/4
✓ Branch 0 taken 56 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 56 times.
✗ Branch 3 not taken.
56 $$= NEW_PTN Item_string(@$, "ROW", 3, system_charset_info);
16224 }
16225 | SYSTEM_SYM
16226 {
16227
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
3 $$= NEW_PTN Item_string(@$, "SYSTEM", 6, system_charset_info);
16228 }
16229 | FORCE_SYM
16230 {
16231 $$= NEW_PTN Item_string(@$, "FORCE", 5, system_charset_info);
16232 }
16233 ;
16234
16235 /* Lock function */
16236
16237 lock:
16238 LOCK_SYM lock_variant
16239 {
16240
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 3053 times.
3062 if (Lex->sphead)
16241 {
16242
1/2
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
9 my_error(ER_SP_BADSTATEMENT, MYF(0), "LOCK");
16243 9 MYSQL_YYABORT;
16244 }
16245 }
16246 ;
16247
16248 lock_variant:
16249 TABLES FOR_SYM BACKUP_SYM
16250 {
16251 109 Lex->sql_command= SQLCOM_LOCK_TABLES_FOR_BACKUP;
16252 }
16253 | table_or_tables
16254 {
16255 2923 Lex->sql_command= SQLCOM_LOCK_TABLES;
16256 }
16257 table_lock_list
16258 {}
16259 | INSTANCE_SYM FOR_SYM BACKUP_SYM
16260 {
16261 38 Lex->sql_command= SQLCOM_LOCK_INSTANCE;
16262
1/2
✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
76 Lex->m_sql_cmd= NEW_PTN Sql_cmd_lock_instance();
16263
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 38 times.
38 if (Lex->m_sql_cmd == nullptr)
16264 MYSQL_YYABORT; // OOM
16265 }
16266 ;
16267
16268 table_or_tables:
16269 TABLE_SYM
16270 | TABLES
16271 ;
16272
16273 table_lock_list:
16274 table_lock
16275 | table_lock_list ',' table_lock
16276 ;
16277
16278 table_lock:
16279 table_ident opt_table_alias lock_option
16280 {
16281 4993 thr_lock_type lock_type= (thr_lock_type) $3;
16282 enum_mdl_type mdl_lock_type;
16283
16284
2/2
✓ Branch 0 taken 1719 times.
✓ Branch 1 taken 3274 times.
4993 if (lock_type >= TL_WRITE_ALLOW_WRITE)
16285 {
16286 /* LOCK TABLE ... WRITE/LOW_PRIORITY WRITE */
16287 1719 mdl_lock_type= MDL_SHARED_NO_READ_WRITE;
16288 }
16289
2/2
✓ Branch 0 taken 1613 times.
✓ Branch 1 taken 1661 times.
3274 else if (lock_type == TL_READ)
16290 {
16291 /* LOCK TABLE ... READ LOCAL */
16292 1613 mdl_lock_type= MDL_SHARED_READ;
16293 }
16294 else
16295 {
16296 /* LOCK TABLE ... READ */
16297 1661 mdl_lock_type= MDL_SHARED_READ_ONLY;
16298 }
16299
16300
2/4
✓ Branch 0 taken 4993 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4993 times.
4993 if (!Select->add_table_to_list(YYTHD, $1, $2.str, 0, lock_type,
16301 mdl_lock_type))
16302 MYSQL_YYABORT;
16303 }
16304 ;
16305
16306 lock_option:
16307 1661 READ_SYM { $$= TL_READ_NO_INSERT; }
16308 1715 | WRITE_SYM { $$= TL_WRITE_DEFAULT; }
16309 | LOW_PRIORITY WRITE_SYM
16310 {
16311 4 $$= TL_WRITE_LOW_PRIORITY;
16312
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 push_deprecated_warn(YYTHD, "LOW_PRIORITY WRITE", "WRITE");
16313 }
16314 1613 | READ_SYM LOCAL_SYM { $$= TL_READ; }
16315 ;
16316
16317 unlock:
16318 UNLOCK_SYM unlock_variant
16319 {
16320
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 4436 times.
4439 if (Lex->sphead)
16321 {
16322
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 my_error(ER_SP_BADSTATEMENT, MYF(0), "UNLOCK");
16323 3 MYSQL_YYABORT;
16324 }
16325 }
16326 ;
16327
16328 unlock_variant:
16329 INSTANCE_SYM
16330 {
16331 33 Lex->sql_command= SQLCOM_UNLOCK_INSTANCE;
16332
1/2
✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
66 Lex->m_sql_cmd= NEW_PTN Sql_cmd_unlock_instance();
16333
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 33 times.
33 if (Lex->m_sql_cmd == nullptr)
16334 MYSQL_YYABORT; // OOM
16335 }
16336 | table_or_tables
16337 {
16338 4406 Lex->sql_command= SQLCOM_UNLOCK_TABLES;
16339 }
16340 ;
16341
16342
16343 shutdown_stmt:
16344 SHUTDOWN
16345 {
16346 9741 Lex->sql_command= SQLCOM_SHUTDOWN;
16347
1/2
✓ Branch 0 taken 9741 times.
✗ Branch 1 not taken.
19482 $$= NEW_PTN PT_shutdown();
16348 }
16349 ;
16350
16351 restart_server_stmt:
16352 RESTART_SYM
16353 {
16354
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
10 $$= NEW_PTN PT_restart_server();
16355 }
16356 ;
16357
16358 alter_instance_stmt:
16359 ALTER INSTANCE_SYM alter_instance_action
16360 {
16361 1257 Lex->sql_command= SQLCOM_ALTER_INSTANCE;
16362 1257 $$= $3;
16363 }
16364
16365 alter_instance_action:
16366 ROTATE_SYM ident_or_text MASTER_SYM KEY_SYM
16367 {
16368
3/4
✓ Branch 0 taken 1103 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 977 times.
✓ Branch 3 taken 126 times.
1103 if (is_identifier($2, "INNODB"))
16369 {
16370
1/2
✓ Branch 0 taken 977 times.
✗ Branch 1 not taken.
977 $$= NEW_PTN PT_alter_instance(ROTATE_INNODB_MASTER_KEY, EMPTY_CSTR, 0);
16371 }
16372
3/4
✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 105 times.
✓ Branch 3 taken 21 times.
126 else if (is_identifier($2, "BINLOG"))
16373 {
16374
1/2
✓ Branch 0 taken 105 times.
✗ Branch 1 not taken.
105 $$= NEW_PTN PT_alter_instance(ROTATE_BINLOG_MASTER_KEY, EMPTY_CSTR, 0);
16375 }
16376 else
16377 {
16378
1/2
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
21 YYTHD->syntax_error_at(@2);
16379 21 MYSQL_YYABORT;
16380 }
16381 }
16382 | ROTATE_SYM ident_or_text SYSTEM_SYM KEY_SYM ulong_num
16383 {
16384
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 if (is_identifier($2, "INNODB"))
16385 {
16386
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if ($5 > UINT_MAX32 - 1)
16387 {
16388 my_error(ER_SYSTEM_KEY_ROTATION_MAX_KEY_ID_EXCEEDED, MYF(0));
16389 MYSQL_YYABORT;
16390 }
16391
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 $$= NEW_PTN PT_alter_instance(ROTATE_INNODB_SYSTEM_KEY, EMPTY_CSTR, $5);
16392 }
16393 else
16394 {
16395 YYTHD->syntax_error_at(@2);
16396 MYSQL_YYABORT;
16397 }
16398 }
16399 | ROTATE_SYM ident_or_text SYSTEM_SYM KEY_SYM
16400 {
16401 if (is_identifier($2, "REDO"))
16402 {
16403 $$= NEW_PTN PT_alter_instance(ROTATE_REDO_SYSTEM_KEY, EMPTY_CSTR, 0);
16404 }
16405 else
16406 {
16407 YYTHD->syntax_error_at(@2);
16408 MYSQL_YYABORT;
16409 }
16410 }
16411 | RELOAD TLS_SYM
16412 {
16413
1/2
✓ Branch 0 taken 98 times.
✗ Branch 1 not taken.
98 $$ = NEW_PTN PT_alter_instance(ALTER_INSTANCE_RELOAD_TLS_ROLLBACK_ON_ERROR, to_lex_cstring("mysql_main"), 0);
16414 }
16415 | RELOAD TLS_SYM NO_SYM ROLLBACK_SYM ON_SYM ERROR_SYM
16416 {
16417
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 $$ = NEW_PTN PT_alter_instance(ALTER_INSTANCE_RELOAD_TLS, to_lex_cstring("mysql_main"), 0);
16418 }
16419 | RELOAD TLS_SYM FOR_SYM CHANNEL_SYM ident {
16420
1/2
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
12 $$ = NEW_PTN PT_alter_instance(ALTER_INSTANCE_RELOAD_TLS_ROLLBACK_ON_ERROR, to_lex_cstring($5), 0);
16421 }
16422 | RELOAD TLS_SYM FOR_SYM CHANNEL_SYM ident NO_SYM ROLLBACK_SYM ON_SYM ERROR_SYM {
16423
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 $$ = NEW_PTN PT_alter_instance(ALTER_INSTANCE_RELOAD_TLS, to_lex_cstring($5), 0);
16424 }
16425 | ENABLE_SYM ident ident
16426 {
16427
2/4
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 21 times.
21 if (!is_identifier($2, "INNODB"))
16428 {
16429 YYTHD->syntax_error_at(@2);
16430 MYSQL_YYABORT;
16431 }
16432
16433
2/4
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 21 times.
21 if (!is_identifier($3, "REDO_LOG"))
16434 {
16435 YYTHD->syntax_error_at(@3);
16436 MYSQL_YYABORT;
16437 }
16438
1/2
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
21 $$ = NEW_PTN PT_alter_instance(ALTER_INSTANCE_ENABLE_INNODB_REDO, EMPTY_CSTR, 0);
16439 }
16440 | DISABLE_SYM ident ident
16441 {
16442
2/4
✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 23 times.
23 if (!is_identifier($2, "INNODB"))
16443 {
16444 YYTHD->syntax_error_at(@2);
16445 MYSQL_YYABORT;
16446 }
16447
16448
2/4
✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 23 times.
23 if (!is_identifier($3, "REDO_LOG"))
16449 {
16450 YYTHD->syntax_error_at(@3);
16451 MYSQL_YYABORT;
16452 }
16453
1/2
✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
23 $$ = NEW_PTN PT_alter_instance(ALTER_INSTANCE_DISABLE_INNODB_REDO, EMPTY_CSTR, 0);
16454 }
16455 | RELOAD KEYRING_SYM {
16456
1/2
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
12 $$ = NEW_PTN PT_alter_instance(RELOAD_KEYRING, EMPTY_CSTR, 0);
16457 }
16458 ;
16459
16460 /*
16461 ** Handler: direct access to ISAM functions
16462 */
16463
16464 handler_stmt:
16465 HANDLER_SYM table_ident OPEN_SYM opt_table_alias
16466 {
16467
2/4
✓ Branch 0 taken 467 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 467 times.
✗ Branch 3 not taken.
467 $$= NEW_PTN PT_handler_open($2, $4);
16468 }
16469 | HANDLER_SYM ident CLOSE_SYM
16470 {
16471
2/4
✓ Branch 0 taken 204 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 204 times.
✗ Branch 3 not taken.
204 $$= NEW_PTN PT_handler_close(to_lex_cstring($2));
16472 }
16473 | HANDLER_SYM /* #1 */
16474 ident /* #2 */
16475 READ_SYM /* #3 */
16476 handler_scan_function /* #4 */
16477 opt_where_clause /* #5 */
16478 opt_limit_clause /* #6 */
16479 {
16480
1/2
✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
294 $$= NEW_PTN PT_handler_table_scan(to_lex_cstring($2), $4, $5, $6);
16481 }
16482 | HANDLER_SYM /* #1 */
16483 ident /* #2 */
16484 READ_SYM /* #3 */
16485 ident /* #4 */
16486 handler_rkey_function /* #5 */
16487 opt_where_clause /* #6 */
16488 opt_limit_clause /* #7 */
16489 {
16490
1/2
✓ Branch 0 taken 272 times.
✗ Branch 1 not taken.
816 $$= NEW_PTN PT_handler_index_scan(to_lex_cstring($2),
16491 816 to_lex_cstring($4), $5, $6, $7);
16492 }
16493 | HANDLER_SYM /* #1 */
16494 ident /* #2 */
16495 READ_SYM /* #3 */
16496 ident /* #4 */
16497 handler_rkey_mode /* #5 */
16498 '(' values ')' /* #6,#7,#8 */
16499 opt_where_clause /* #9 */
16500 opt_limit_clause /* #10 */
16501 {
16502
1/2
✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
171 $$= NEW_PTN PT_handler_index_range_scan(to_lex_cstring($2),
16503 114 to_lex_cstring($4),
16504 114 $5, $7, $9, $10);
16505 }
16506 ;
16507
16508 handler_scan_function:
16509 181 FIRST_SYM { $$= enum_ha_read_modes::RFIRST; }
16510 113 | NEXT_SYM { $$= enum_ha_read_modes::RNEXT; }
16511 ;
16512
16513 handler_rkey_function:
16514 60 FIRST_SYM { $$= enum_ha_read_modes::RFIRST; }
16515 125 | NEXT_SYM { $$= enum_ha_read_modes::RNEXT; }
16516 65 | PREV_SYM { $$= enum_ha_read_modes::RPREV; }
16517 22 | LAST_SYM { $$= enum_ha_read_modes::RLAST; }
16518 ;
16519
16520 handler_rkey_mode:
16521 39 EQ { $$=HA_READ_KEY_EXACT; }
16522 8 | GE { $$=HA_READ_KEY_OR_NEXT; }
16523 8 | LE { $$=HA_READ_KEY_OR_PREV; }
16524 2 | GT_SYM { $$=HA_READ_AFTER_KEY; }
16525 2 | LT { $$=HA_READ_BEFORE_KEY; }
16526 ;
16527
16528 /* GRANT / REVOKE */
16529
16530 revoke:
16531 REVOKE if_exists role_or_privilege_list FROM user_list opt_ignore_unknown_user
16532 {
16533 256 Lex->grant_if_exists = $2;
16534 256 Lex->ignore_unknown_user = $6;
16535
1/2
✓ Branch 0 taken 256 times.
✗ Branch 1 not taken.
256 auto *tmp= NEW_PTN PT_revoke_roles($3, $5);
16536
5/10
✓ Branch 0 taken 256 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 256 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 256 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 256 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 256 times.
256 MAKE_CMD(tmp);
16537 }
16538 | REVOKE if_exists role_or_privilege_list ON_SYM opt_acl_type grant_ident FROM user_list opt_ignore_unknown_user
16539 {
16540 1756 LEX *lex= Lex;
16541 1756 lex->grant_if_exists = $2;
16542 1756 Lex->ignore_unknown_user = $9;
16543
3/4
✓ Branch 0 taken 1756 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1755 times.
1756 if (apply_privileges(YYTHD, *$3))
16544 1 MYSQL_YYABORT;
16545
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1755 times.
1755 lex->sql_command= (lex->grant == GLOBAL_ACLS) ? SQLCOM_REVOKE_ALL
16546 : SQLCOM_REVOKE;
16547
6/6
✓ Branch 0 taken 51 times.
✓ Branch 1 taken 1704 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 50 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 1754 times.
1755 if ($5 != Acl_type::TABLE && !lex->columns.is_empty())
16548 {
16549
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 YYTHD->syntax_error();
16550 1 MYSQL_YYABORT;
16551 }
16552 1754 lex->type= static_cast<ulong>($5);
16553 1754 lex->users_list= *$8;
16554 }
16555 | REVOKE if_exists ALL opt_privileges
16556 {
16557 263 Lex->grant_if_exists = $2;
16558 263 Lex->all_privileges= 1;
16559 263 Lex->grant= GLOBAL_ACLS;
16560 }
16561 ON_SYM opt_acl_type grant_ident FROM user_list opt_ignore_unknown_user
16562 {
16563 261 LEX *lex= Lex;
16564
2/2
✓ Branch 0 taken 125 times.
✓ Branch 1 taken 136 times.
261 lex->sql_command= (lex->grant == (GLOBAL_ACLS & ~GRANT_ACL)) ?
16565 SQLCOM_REVOKE_ALL
16566 : SQLCOM_REVOKE;
16567
4/6
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 260 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 261 times.
261 if ($7 != Acl_type::TABLE && !lex->columns.is_empty())
16568 {
16569 YYTHD->syntax_error();
16570 MYSQL_YYABORT;
16571 }
16572 261 lex->type= static_cast<ulong>($7);
16573 261 lex->users_list= *$10;
16574 261 lex->ignore_unknown_user = $11;
16575 }
16576 | REVOKE if_exists ALL opt_privileges ',' GRANT OPTION FROM user_list opt_ignore_unknown_user
16577 {
16578 1324 Lex->grant_if_exists = $2;
16579 1324 Lex->ignore_unknown_user = $10;
16580 1324 Lex->sql_command = SQLCOM_REVOKE_ALL;
16581 1324 Lex->users_list= *$9;
16582 }
16583 | REVOKE if_exists PROXY_SYM ON_SYM user FROM user_list opt_ignore_unknown_user
16584 {
16585 41 LEX *lex= Lex;
16586 41 lex->grant_if_exists = $2;
16587 41 lex->ignore_unknown_user = $8;
16588 41 lex->sql_command= SQLCOM_REVOKE;
16589 41 lex->users_list= *$7;
16590
1/2
✓ Branch 0 taken 41 times.
✗ Branch 1 not taken.
41 lex->users_list.push_front ($5);
16591 41 lex->type= TYPE_ENUM_PROXY;
16592 }
16593 ;
16594
16595 grant:
16596 GRANT role_or_privilege_list TO_SYM user_list opt_with_admin_option
16597 {
16598
1/2
✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
666 auto *tmp= NEW_PTN PT_grant_roles($2, $4, $5);
16599
5/10
✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 666 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 666 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 666 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 666 times.
666 MAKE_CMD(tmp);
16600 }
16601 | GRANT role_or_privilege_list ON_SYM opt_acl_type grant_ident TO_SYM user_list
16602 grant_options opt_grant_as
16603 {
16604 7971 LEX *lex= Lex;
16605 7971 lex->sql_command= SQLCOM_GRANT;
16606
3/4
✓ Branch 0 taken 7971 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 7967 times.
7971 if (apply_privileges(YYTHD, *$2))
16607 4 MYSQL_YYABORT;
16608
16609
6/6
✓ Branch 0 taken 192 times.
✓ Branch 1 taken 7775 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 191 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 7966 times.
7967 if ($4 != Acl_type::TABLE && !lex->columns.is_empty())
16610 {
16611
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 YYTHD->syntax_error();
16612 1 MYSQL_YYABORT;
16613 }
16614 7966 lex->type= static_cast<ulong>($4);
16615 7966 lex->users_list= *$7;
16616 }
16617 | GRANT ALL opt_privileges
16618 {
16619 1985 Lex->all_privileges= 1;
16620 1985 Lex->grant= GLOBAL_ACLS;
16621 }
16622 ON_SYM opt_acl_type grant_ident TO_SYM user_list grant_options opt_grant_as
16623 {
16624 1982 LEX *lex= Lex;
16625 1982 lex->sql_command= SQLCOM_GRANT;
16626
4/6
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1978 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1982 times.
1982 if ($6 != Acl_type::TABLE && !lex->columns.is_empty())
16627 {
16628 YYTHD->syntax_error();
16629 MYSQL_YYABORT;
16630 }
16631 1982 lex->type= static_cast<ulong>($6);
16632 1982 lex->users_list= *$9;
16633 }
16634 | GRANT PROXY_SYM ON_SYM user TO_SYM user_list opt_grant_option
16635 {
16636 412 LEX *lex= Lex;
16637 412 lex->sql_command= SQLCOM_GRANT;
16638
2/2
✓ Branch 0 taken 288 times.
✓ Branch 1 taken 124 times.
412 if ($7)
16639 288 lex->grant |= GRANT_ACL;
16640 412 lex->users_list= *$6;
16641
1/2
✓ Branch 0 taken 412 times.
✗ Branch 1 not taken.
412 lex->users_list.push_front ($4);
16642 412 lex->type= TYPE_ENUM_PROXY;
16643 }
16644 ;
16645
16646 opt_acl_type:
16647 11735 /* Empty */ { $$= Acl_type::TABLE; }
16648 29 | TABLE_SYM { $$= Acl_type::TABLE; }
16649 54 | FUNCTION_SYM { $$= Acl_type::FUNCTION; }
16650 205 | PROCEDURE_SYM { $$= Acl_type::PROCEDURE; }
16651 ;
16652
16653 opt_privileges:
16654 /* empty */
16655 | PRIVILEGES
16656 ;
16657
16658 role_or_privilege_list:
16659 role_or_privilege
16660 {
16661
2/4
✓ Branch 0 taken 10702 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10702 times.
✗ Branch 3 not taken.
10702 $$= NEW_PTN Mem_root_array<PT_role_or_privilege *>(YYMEM_ROOT);
16662
4/8
✓ Branch 0 taken 10702 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10702 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 10702 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 10702 times.
10702 if ($$ == NULL || $$->push_back($1))
16663 MYSQL_YYABORT; // OOM
16664 }
16665 | role_or_privilege_list ',' role_or_privilege
16666 {
16667 2185 $$= $1;
16668
2/4
✓ Branch 0 taken 2185 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2185 times.
2185 if ($$->push_back($3))
16669 MYSQL_YYABORT; // OOM
16670 }
16671 ;
16672
16673 role_or_privilege:
16674 role_ident_or_text opt_column_list
16675 {
16676
1/2
✓ Branch 0 taken 4185 times.
✗ Branch 1 not taken.
4185 if ($2 == NULL)
16677
2/4
✓ Branch 0 taken 4185 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4185 times.
✗ Branch 3 not taken.
4185 $$= NEW_PTN PT_role_or_dynamic_privilege(@1, $1);
16678 else
16679 $$= NEW_PTN PT_dynamic_privilege(@1, $1);
16680 }
16681 | role_ident_or_text '@' ident_or_text
16682
2/4
✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
✗ Branch 3 not taken.
22 { $$= NEW_PTN PT_role_at_host(@1, $1, $3); }
16683 | SELECT_SYM opt_column_list
16684
2/4
✓ Branch 0 taken 3823 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3823 times.
✗ Branch 3 not taken.
3823 { $$= NEW_PTN PT_static_privilege(@1, SELECT_ACL, $2); }
16685 | INSERT_SYM opt_column_list
16686
2/4
✓ Branch 0 taken 1431 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1431 times.
✗ Branch 3 not taken.
1431 { $$= NEW_PTN PT_static_privilege(@1, INSERT_ACL, $2); }
16687 | UPDATE_SYM opt_column_list
16688
2/4
✓ Branch 0 taken 742 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 742 times.
✗ Branch 3 not taken.
742 { $$= NEW_PTN PT_static_privilege(@1, UPDATE_ACL, $2); }
16689 | REFERENCES opt_column_list
16690
2/4
✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
✗ Branch 3 not taken.
38 { $$= NEW_PTN PT_static_privilege(@1, REFERENCES_ACL, $2); }
16691 | DELETE_SYM
16692
2/4
✓ Branch 0 taken 290 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 290 times.
✗ Branch 3 not taken.
290 { $$= NEW_PTN PT_static_privilege(@1, DELETE_ACL); }
16693 | USAGE
16694
2/4
✓ Branch 0 taken 86 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 86 times.
✗ Branch 3 not taken.
86 { $$= NEW_PTN PT_static_privilege(@1, 0); }
16695 | INDEX_SYM
16696
2/4
✓ Branch 0 taken 11 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11 times.
✗ Branch 3 not taken.
11 { $$= NEW_PTN PT_static_privilege(@1, INDEX_ACL); }
16697 | ALTER
16698
2/4
✓ Branch 0 taken 55 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 55 times.
✗ Branch 3 not taken.
55 { $$= NEW_PTN PT_static_privilege(@1, ALTER_ACL); }
16699 | CREATE
16700
2/4
✓ Branch 0 taken 237 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 237 times.
✗ Branch 3 not taken.
237 { $$= NEW_PTN PT_static_privilege(@1, CREATE_ACL); }
16701 | DROP
16702
2/4
✓ Branch 0 taken 137 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 137 times.
✗ Branch 3 not taken.
137 { $$= NEW_PTN PT_static_privilege(@1, DROP_ACL); }
16703 | EXECUTE_SYM
16704
2/4
✓ Branch 0 taken 378 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 378 times.
✗ Branch 3 not taken.
378 { $$= NEW_PTN PT_static_privilege(@1, EXECUTE_ACL); }
16705 | RELOAD
16706
2/4
✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 53 times.
✗ Branch 3 not taken.
53 { $$= NEW_PTN PT_static_privilege(@1, RELOAD_ACL); }
16707 | SHUTDOWN
16708
2/4
✓ Branch 0 taken 291 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 291 times.
✗ Branch 3 not taken.
291 { $$= NEW_PTN PT_static_privilege(@1, SHUTDOWN_ACL); }
16709 | PROCESS
16710
2/4
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48 times.
✗ Branch 3 not taken.
48 { $$= NEW_PTN PT_static_privilege(@1, PROCESS_ACL); }
16711 | FILE_SYM
16712
2/4
✓ Branch 0 taken 49 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 49 times.
✗ Branch 3 not taken.
49 { $$= NEW_PTN PT_static_privilege(@1, FILE_ACL); }
16713 | GRANT OPTION
16714 {
16715
2/4
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
✗ Branch 3 not taken.
25 $$= NEW_PTN PT_static_privilege(@1, GRANT_ACL);
16716 25 Lex->grant_privilege= true;
16717 }
16718 | SHOW DATABASES
16719
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 { $$= NEW_PTN PT_static_privilege(@1, SHOW_DB_ACL); }
16720 | SUPER_SYM
16721 {
16722 /* DEPRECATED */
16723
2/4
✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
356 $$= NEW_PTN PT_static_privilege(@1, SUPER_ACL);
16724
1/2
✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
356 if (Lex->grant != GLOBAL_ACLS)
16725 {
16726 /*
16727 An explicit request was made for the SUPER priv id
16728 */
16729
1/2
✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
356 push_warning(Lex->thd, Sql_condition::SL_WARNING,
16730 ER_WARN_DEPRECATED_SYNTAX,
16731 "The SUPER privilege identifier is deprecated");
16732 }
16733 }
16734 | CREATE TEMPORARY TABLES
16735
2/4
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
15 { $$= NEW_PTN PT_static_privilege(@1, CREATE_TMP_ACL); }
16736 | LOCK_SYM TABLES
16737
2/4
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
21 { $$= NEW_PTN PT_static_privilege(@1, LOCK_TABLES_ACL); }
16738 | REPLICATION SLAVE
16739
2/4
✓ Branch 0 taken 154 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 154 times.
✗ Branch 3 not taken.
154 { $$= NEW_PTN PT_static_privilege(@1, REPL_SLAVE_ACL); }
16740 | REPLICATION CLIENT_SYM
16741
2/4
✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
✗ Branch 3 not taken.
14 { $$= NEW_PTN PT_static_privilege(@1, REPL_CLIENT_ACL); }
16742 | CREATE VIEW_SYM
16743
2/4
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
✗ Branch 3 not taken.
25 { $$= NEW_PTN PT_static_privilege(@1, CREATE_VIEW_ACL); }
16744 | SHOW VIEW_SYM
16745
2/4
✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35 times.
✗ Branch 3 not taken.
35 { $$= NEW_PTN PT_static_privilege(@1, SHOW_VIEW_ACL); }
16746 | CREATE ROUTINE_SYM
16747
2/4
✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 58 times.
✗ Branch 3 not taken.
58 { $$= NEW_PTN PT_static_privilege(@1, CREATE_PROC_ACL); }
16748 | ALTER ROUTINE_SYM
16749
2/4
✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29 times.
✗ Branch 3 not taken.
29 { $$= NEW_PTN PT_static_privilege(@1, ALTER_PROC_ACL); }
16750 | CREATE USER
16751
2/4
✓ Branch 0 taken 43 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 43 times.
✗ Branch 3 not taken.
43 { $$= NEW_PTN PT_static_privilege(@1, CREATE_USER_ACL); }
16752 | EVENT_SYM
16753
2/4
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
21 { $$= NEW_PTN PT_static_privilege(@1, EVENT_ACL); }
16754 | TRIGGER_SYM
16755
2/4
✓ Branch 0 taken 174 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 174 times.
✗ Branch 3 not taken.
174 { $$= NEW_PTN PT_static_privilege(@1, TRIGGER_ACL); }
16756 | CREATE TABLESPACE_SYM
16757
2/4
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
✗ Branch 3 not taken.
25 { $$= NEW_PTN PT_static_privilege(@1, CREATE_TABLESPACE_ACL); }
16758 | CREATE ROLE_SYM
16759
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
6 { $$= NEW_PTN PT_static_privilege(@1, CREATE_ROLE_ACL); }
16760 | DROP ROLE_SYM
16761
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
6 { $$= NEW_PTN PT_static_privilege(@1, DROP_ROLE_ACL); }
16762 ;
16763
16764 opt_with_admin_option:
16765 638 /* empty */ { $$= false; }
16766 28 | WITH ADMIN_SYM OPTION { $$= true; }
16767 ;
16768
16769 opt_and:
16770 /* empty */
16771 | AND_SYM
16772 ;
16773
16774 require_list:
16775 require_list_element opt_and require_list
16776 | require_list_element
16777 ;
16778
16779 require_list_element:
16780 SUBJECT_SYM TEXT_STRING
16781 {
16782 135 LEX *lex=Lex;
16783
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 135 times.
135 if (lex->x509_subject)
16784 {
16785 my_error(ER_DUP_ARGUMENT, MYF(0), "SUBJECT");
16786 MYSQL_YYABORT;
16787 }
16788 135 lex->x509_subject=$2.str;
16789 }
16790 | ISSUER_SYM TEXT_STRING
16791 {
16792 128 LEX *lex=Lex;
16793
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 128 times.
128 if (lex->x509_issuer)
16794 {
16795 my_error(ER_DUP_ARGUMENT, MYF(0), "ISSUER");
16796 MYSQL_YYABORT;
16797 }
16798 128 lex->x509_issuer=$2.str;
16799 }
16800 | CIPHER_SYM TEXT_STRING
16801 {
16802 112 LEX *lex=Lex;
16803
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 112 times.
112 if (lex->ssl_cipher)
16804 {
16805 my_error(ER_DUP_ARGUMENT, MYF(0), "CIPHER");
16806 MYSQL_YYABORT;
16807 }
16808 112 lex->ssl_cipher=$2.str;
16809 }
16810 ;
16811
16812 grant_ident:
16813 '*'
16814 {
16815 6 LEX *lex= Lex;
16816 size_t dummy;
16817
3/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 4 times.
6 if (lex->copy_db_to(&lex->current_query_block()->db, &dummy))
16818 2 MYSQL_YYABORT;
16819
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
4 if (lex->grant == GLOBAL_ACLS)
16820 1 lex->grant = DB_OP_ACLS;
16821
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 else if (lex->columns.elements)
16822 {
16823 my_error(ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0));
16824 MYSQL_YYABORT;
16825 }
16826 }
16827 | schema '.' '*'
16828 {
16829 2327 LEX *lex= Lex;
16830 2327 lex->current_query_block()->db = $1.str;
16831
2/2
✓ Branch 0 taken 392 times.
✓ Branch 1 taken 1935 times.
2327 if (lex->grant == GLOBAL_ACLS)
16832 392 lex->grant = DB_OP_ACLS;
16833
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1935 times.
1935 else if (lex->columns.elements)
16834 {
16835 my_error(ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0));
16836 MYSQL_YYABORT;
16837 }
16838 }
16839 | '*' '.' '*'
16840 {
16841 7871 LEX *lex= Lex;
16842 7871 lex->current_query_block()->db = NULL;
16843
2/2
✓ Branch 0 taken 1713 times.
✓ Branch 1 taken 6158 times.
7871 if (lex->grant == GLOBAL_ACLS)
16844 1713 lex->grant= GLOBAL_ACLS & ~GRANT_ACL;
16845
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6158 times.
6158 else if (lex->columns.elements)
16846 {
16847 my_error(ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0));
16848 MYSQL_YYABORT;
16849 }
16850 }
16851 | ident
16852 {
16853
1/2
✓ Branch 0 taken 531 times.
✗ Branch 1 not taken.
531 auto tmp = NEW_PTN Table_ident(to_lex_cstring($1));
16854
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 531 times.
531 if (tmp == NULL)
16855 MYSQL_YYABORT;
16856 531 LEX *lex=Lex;
16857
3/4
✓ Branch 0 taken 531 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 527 times.
531 if (!lex->current_query_block()->add_table_to_list(lex->thd, tmp, NULL,
16858 TL_OPTION_UPDATING))
16859 4 MYSQL_YYABORT;
16860
2/2
✓ Branch 0 taken 44 times.
✓ Branch 1 taken 483 times.
527 if (lex->grant == GLOBAL_ACLS)
16861 44 lex->grant = TABLE_OP_ACLS;
16862 }
16863 | schema '.' ident
16864 {
16865
1/2
✓ Branch 0 taken 1288 times.
✗ Branch 1 not taken.
1288 auto schema_name = YYCLIENT_NO_SCHEMA ? LEX_CSTRING{}
16866
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1288 times.
1288 : to_lex_cstring($1.str);
16867
1/2
✓ Branch 0 taken 1288 times.
✗ Branch 1 not taken.
1288 auto tmp = NEW_PTN Table_ident(schema_name, to_lex_cstring($3));
16868
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1288 times.
1288 if (tmp == NULL)
16869 MYSQL_YYABORT;
16870 1288 LEX *lex=Lex;
16871
2/4
✓ Branch 0 taken 1288 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1288 times.
1288 if (!lex->current_query_block()->add_table_to_list(lex->thd, tmp, NULL,
16872 TL_OPTION_UPDATING))
16873 MYSQL_YYABORT;
16874
2/2
✓ Branch 0 taken 93 times.
✓ Branch 1 taken 1195 times.
1288 if (lex->grant == GLOBAL_ACLS)
16875 93 lex->grant = TABLE_OP_ACLS;
16876 }
16877 ;
16878
16879 user_list:
16880 user
16881 {
16882
1/2
✓ Branch 0 taken 19466 times.
✗ Branch 1 not taken.
19466 $$= new (YYMEM_ROOT) List<LEX_USER>;
16883
4/8
✓ Branch 0 taken 19466 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 19466 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 19466 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 19466 times.
19466 if ($$ == NULL || $$->push_back($1))
16884 MYSQL_YYABORT;
16885 }
16886 | user_list ',' user
16887 {
16888 2273 $$= $1;
16889
2/4
✓ Branch 0 taken 2273 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2273 times.
2273 if ($$->push_back($3))
16890 MYSQL_YYABORT;
16891 }
16892 ;
16893
16894 role_list:
16895 role
16896 {
16897
1/2
✓ Branch 0 taken 1895 times.
✗ Branch 1 not taken.
1895 $$= new (YYMEM_ROOT) List<LEX_USER>;
16898
4/8
✓ Branch 0 taken 1895 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1895 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1895 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1895 times.
1895 if ($$ == NULL || $$->push_back($1))
16899 MYSQL_YYABORT;
16900 }
16901 | role_list ',' role
16902 {
16903 546 $$= $1;
16904
2/4
✓ Branch 0 taken 546 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 546 times.
546 if ($$->push_back($3))
16905 MYSQL_YYABORT;
16906 }
16907 ;
16908
16909 opt_retain_current_password:
16910 2184 /* empty */ { $$= false; }
16911 60 | RETAIN_SYM CURRENT_SYM PASSWORD { $$= true; }
16912 ;
16913
16914 opt_discard_old_password:
16915 788 /* empty */ { $$= false; }
16916 41 | DISCARD_SYM OLD_SYM PASSWORD { $$= true; }
16917
16918
16919 opt_user_registration:
16920 factor INITIATE_SYM REGISTRATION_SYM
16921 {
16922 LEX_MFA *m = NEW_PTN LEX_MFA;
16923 if (m == nullptr)
16924 MYSQL_YYABORT; // OOM
16925 m->nth_factor= $1;
16926 m->init_registration= true;
16927 m->requires_registration= true;
16928 $$ = m;
16929 }
16930 | factor UNREGISTER_SYM
16931 {
16932 LEX_MFA *m = NEW_PTN LEX_MFA;
16933 if (m == nullptr)
16934 MYSQL_YYABORT; // OOM
16935 m->nth_factor= $1;
16936 m->unregister= true;
16937 $$ = m;
16938 }
16939 | factor FINISH_SYM REGISTRATION_SYM SET_SYM CHALLENGE_RESPONSE_SYM AS TEXT_STRING_hash
16940 {
16941 LEX_MFA *m = NEW_PTN LEX_MFA;
16942 if (m == nullptr)
16943 MYSQL_YYABORT; // OOM
16944 m->nth_factor= $1;
16945 m->finish_registration= true;
16946 m->requires_registration= true;
16947 m->challenge_response= to_lex_cstring($7);
16948 $$ = m;
16949 }
16950 ;
16951
16952 create_user:
16953 user identification opt_create_user_with_mfa
16954 {
16955 3716 $$ = $1;
16956 3716 $$->first_factor_auth_info = *$2;
16957
2/4
✓ Branch 0 taken 3716 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3716 times.
3716 if ($$->add_mfa_identifications($3.mfa2, $3.mfa3))
16958 MYSQL_YYABORT; // OOM
16959 }
16960 | user identified_with_plugin opt_initial_auth
16961 {
16962 $$= $1;
16963 /* set $3 as first factor auth method */
16964 $3->nth_factor = 1;
16965 $3->passwordless = false;
16966 $$->first_factor_auth_info = *$3;
16967 /* set $2 as second factor auth method */
16968 $2->nth_factor = 2;
16969 $2->passwordless = true;
16970 if ($$->mfa_list.push_back($2))
16971 MYSQL_YYABORT; // OOM
16972 $$->with_initial_auth = true;
16973 }
16974 | user opt_create_user_with_mfa
16975 {
16976 3716 $$ = $1;
16977
2/4
✓ Branch 0 taken 3716 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3716 times.
3716 if ($$->add_mfa_identifications($2.mfa2, $2.mfa3))
16978 MYSQL_YYABORT; // OOM
16979 }
16980 ;
16981
16982 opt_create_user_with_mfa:
16983 7432 /* empty */ { $$ = {}; }
16984 | AND_SYM identification
16985 {
16986 $2->nth_factor = 2;
16987 $$ = {$2, nullptr};
16988 }
16989 | AND_SYM identification AND_SYM identification
16990 {
16991 $2->nth_factor = 2;
16992 $4->nth_factor = 3;
16993 $$ = {$2, $4};
16994 }
16995 ;
16996
16997 identification:
16998 identified_by_password
16999 | identified_by_random_password
17000 | identified_with_plugin
17001 | identified_with_plugin_as_auth
17002 | identified_with_plugin_by_password
17003 | identified_with_plugin_by_random_password
17004 ;
17005
17006 identified_by_password:
17007 IDENTIFIED_SYM BY TEXT_STRING_password
17008 {
17009
2/4
✓ Branch 0 taken 2079 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2079 times.
✗ Branch 3 not taken.
2079 LEX_MFA *m = NEW_PTN LEX_MFA;
17010
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2079 times.
2079 if (m == nullptr)
17011 MYSQL_YYABORT; // OOM
17012 2079 m->auth = to_lex_cstring($3);
17013 2079 m->uses_identified_by_clause = true;
17014 2079 $$ = m;
17015 2079 Lex->contains_plaintext_password= true;
17016 }
17017 ;
17018
17019 identified_by_random_password:
17020 IDENTIFIED_SYM BY RANDOM_SYM PASSWORD
17021 {
17022
2/4
✓ Branch 0 taken 129 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 129 times.
✗ Branch 3 not taken.
129 LEX_MFA *m = NEW_PTN LEX_MFA;
17023
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 129 times.
129 if (m == nullptr)
17024 MYSQL_YYABORT; // OOM
17025 129 m->auth = EMPTY_CSTR;
17026 129 m->has_password_generator = true;
17027 129 m->uses_identified_by_clause = true;
17028 129 $$ = m;
17029 129 Lex->contains_plaintext_password = true;
17030 }
17031 ;
17032
17033 identified_with_plugin:
17034 IDENTIFIED_SYM WITH ident_or_text
17035 {
17036
2/4
✓ Branch 0 taken 1280 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1280 times.
✗ Branch 3 not taken.
1280 LEX_MFA *m = NEW_PTN LEX_MFA;
17037
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1280 times.
1280 if (m == nullptr)
17038 MYSQL_YYABORT; // OOM
17039 1280 m->plugin = to_lex_cstring($3);
17040 1280 m->auth = EMPTY_CSTR;
17041 1280 m->uses_identified_by_clause = false;
17042 1280 m->uses_identified_with_clause = true;
17043 1280 $$ = m;
17044 }
17045 ;
17046
17047 identified_with_plugin_as_auth:
17048 IDENTIFIED_SYM WITH ident_or_text AS TEXT_STRING_hash
17049 {
17050
2/4
✓ Branch 0 taken 1167 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1167 times.
✗ Branch 3 not taken.
1167 LEX_MFA *m = NEW_PTN LEX_MFA;
17051
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1167 times.
1167 if (m == nullptr)
17052 MYSQL_YYABORT; // OOM
17053 1167 m->plugin = to_lex_cstring($3);
17054 1167 m->auth = to_lex_cstring($5);
17055 1167 m->uses_authentication_string_clause = true;
17056 1167 m->uses_identified_with_clause = true;
17057 1167 $$ = m;
17058 }
17059 ;
17060
17061 identified_with_plugin_by_password:
17062 IDENTIFIED_SYM WITH ident_or_text BY TEXT_STRING_password
17063 {
17064
2/4
✓ Branch 0 taken 509 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 509 times.
✗ Branch 3 not taken.
509 LEX_MFA *m = NEW_PTN LEX_MFA;
17065
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 509 times.
509 if (m == nullptr)
17066 MYSQL_YYABORT; // OOM
17067 509 m->plugin = to_lex_cstring($3);
17068 509 m->auth = to_lex_cstring($5);
17069 509 m->uses_identified_by_clause = true;
17070 509 m->uses_identified_with_clause = true;
17071 509 $$ = m;
17072 509 Lex->contains_plaintext_password= true;
17073 }
17074 ;
17075
17076 identified_with_plugin_by_random_password:
17077 IDENTIFIED_SYM WITH ident_or_text BY RANDOM_SYM PASSWORD
17078 {
17079
2/4
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
7 LEX_MFA *m = NEW_PTN LEX_MFA;
17080
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
7 if (m == nullptr)
17081 MYSQL_YYABORT; // OOM
17082 7 m->plugin = to_lex_cstring($3);
17083 7 m->uses_identified_by_clause = true;
17084 7 m->uses_identified_with_clause = true;
17085 7 m->has_password_generator = true;
17086 7 $$ = m;
17087 7 Lex->contains_plaintext_password= true;
17088 }
17089 ;
17090
17091 opt_initial_auth:
17092 INITIAL_SYM AUTHENTICATION_SYM identified_by_random_password
17093 {
17094 $$ = $3;
17095 $3->passwordless = true;
17096 $3->nth_factor = 2;
17097 }
17098 | INITIAL_SYM AUTHENTICATION_SYM identified_with_plugin_as_auth
17099 {
17100 $$ = $3;
17101 $3->passwordless = true;
17102 $3->nth_factor = 2;
17103 }
17104 | INITIAL_SYM AUTHENTICATION_SYM identified_by_password
17105 {
17106 $$ = $3;
17107 $3->passwordless = true;
17108 $3->nth_factor = 2;
17109 }
17110 ;
17111
17112 alter_user:
17113 user identified_by_password
17114 REPLACE_SYM TEXT_STRING_password
17115 opt_retain_current_password
17116 {
17117 135 $$ = $1;
17118 135 $1->first_factor_auth_info = *$2;
17119 135 $1->current_auth = to_lex_cstring($4);
17120 135 $1->uses_replace_clause = true;
17121 135 $1->discard_old_password = false;
17122 135 $1->retain_current_password = $5;
17123 }
17124 | user identified_with_plugin_by_password
17125 REPLACE_SYM TEXT_STRING_password
17126 opt_retain_current_password
17127 {
17128 $$ = $1;
17129 $1->first_factor_auth_info = *$2;
17130 $1->current_auth = to_lex_cstring($4);
17131 $1->uses_replace_clause = true;
17132 $1->discard_old_password = false;
17133 $1->retain_current_password = $5;
17134 }
17135 | user identified_by_password opt_retain_current_password
17136 {
17137 735 $$ = $1;
17138 735 $1->first_factor_auth_info = *$2;
17139 735 $1->discard_old_password = false;
17140 735 $1->retain_current_password = $3;
17141 }
17142 | user identified_by_random_password opt_retain_current_password
17143 {
17144 53 $$ = $1;
17145 53 $1->first_factor_auth_info = *$2;
17146 53 $1->discard_old_password = false;
17147 53 $1->retain_current_password = $3;
17148 }
17149 | user identified_by_random_password
17150 REPLACE_SYM TEXT_STRING_password
17151 opt_retain_current_password
17152 {
17153 3 $$ = $1;
17154 3 $1->first_factor_auth_info = *$2;
17155 3 $1->uses_replace_clause = true;
17156 3 $1->discard_old_password = false;
17157 3 $1->retain_current_password = $5;
17158 3 $1->current_auth = to_lex_cstring($4);
17159 }
17160 | user identified_with_plugin
17161 {
17162 100 $$ = $1;
17163 100 $1->first_factor_auth_info = *$2;
17164 100 $1->discard_old_password = false;
17165 100 $1->retain_current_password = false;
17166 }
17167 | user identified_with_plugin_as_auth opt_retain_current_password
17168 {
17169 183 $$ = $1;
17170 183 $1->first_factor_auth_info = *$2;
17171 183 $1->discard_old_password = false;
17172 183 $1->retain_current_password = $3;
17173 }
17174 | user identified_with_plugin_by_password opt_retain_current_password
17175 {
17176 72 $$ = $1;
17177 72 $1->first_factor_auth_info = *$2;
17178 72 $1->discard_old_password = false;
17179 72 $1->retain_current_password = $3;
17180 }
17181 | user identified_with_plugin_by_random_password
17182 opt_retain_current_password
17183 {
17184 6 $$ = $1;
17185 6 $1->first_factor_auth_info = *$2;
17186 6 $1->discard_old_password= false;
17187 6 $1->retain_current_password= $3;
17188 }
17189 | user opt_discard_old_password
17190 {
17191 829 $$ = $1;
17192 829 $1->discard_old_password = $2;
17193 829 $1->retain_current_password = false;
17194 }
17195 | user ADD factor identification
17196 {
17197 $4->nth_factor = $3;
17198 $4->add_factor = true;
17199 if ($1->add_mfa_identifications($4))
17200 MYSQL_YYABORT; // OOM
17201 $$ = $1;
17202 }
17203 | user ADD factor identification ADD factor identification
17204 {
17205 if ($3 == $6) {
17206 my_error(ER_MFA_METHODS_IDENTICAL, MYF(0));
17207 MYSQL_YYABORT;
17208 } else if ($3 > $6) {
17209 my_error(ER_MFA_METHODS_INVALID_ORDER, MYF(0), $6, $3);
17210 MYSQL_YYABORT;
17211 }
17212 $4->nth_factor = $3;
17213 $4->add_factor = true;
17214 $7->nth_factor = $6;
17215 $7->add_factor = true;
17216 if ($1->add_mfa_identifications($4, $7))
17217 MYSQL_YYABORT; // OOM
17218 $$ = $1;
17219 }
17220 | user MODIFY_SYM factor identification
17221 {
17222 $4->nth_factor = $3;
17223 $4->modify_factor = true;
17224 if ($1->add_mfa_identifications($4))
17225 MYSQL_YYABORT; // OOM
17226 $$ = $1;
17227 }
17228 | user MODIFY_SYM factor identification MODIFY_SYM factor identification
17229 {
17230 if ($3 == $6) {
17231 my_error(ER_MFA_METHODS_IDENTICAL, MYF(0));
17232 MYSQL_YYABORT;
17233 }
17234 $4->nth_factor = $3;
17235 $4->modify_factor = true;
17236 $7->nth_factor = $6;
17237 $7->modify_factor = true;
17238 if ($1->add_mfa_identifications($4, $7))
17239 MYSQL_YYABORT; // OOM
17240 $$ = $1;
17241 }
17242 | user DROP factor
17243 {
17244 LEX_MFA *m = NEW_PTN LEX_MFA;
17245 if (m == nullptr)
17246 MYSQL_YYABORT; // OOM
17247 m->nth_factor = $3;
17248 m->drop_factor = true;
17249 if ($1->add_mfa_identifications(m))
17250 MYSQL_YYABORT; // OOM
17251 $$ = $1;
17252 }
17253 | user DROP factor DROP factor
17254 {
17255 if ($3 == $5) {
17256 my_error(ER_MFA_METHODS_IDENTICAL, MYF(0));
17257 MYSQL_YYABORT;
17258 }
17259 LEX_MFA *m1 = NEW_PTN LEX_MFA;
17260 if (m1 == nullptr)
17261 MYSQL_YYABORT; // OOM
17262 m1->nth_factor = $3;
17263 m1->drop_factor = true;
17264 LEX_MFA *m2 = NEW_PTN LEX_MFA;
17265 if (m2 == nullptr)
17266 MYSQL_YYABORT; // OOM
17267 m2->nth_factor = $5;
17268 m2->drop_factor = true;
17269 if ($1->add_mfa_identifications(m1, m2))
17270 MYSQL_YYABORT; // OOM
17271 $$ = $1;
17272 }
17273 ;
17274
17275 factor:
17276 NUM FACTOR_SYM
17277 {
17278 if (my_strcasecmp(system_charset_info, $1.str, "2") == 0) {
17279 $$ = 2;
17280 } else if (my_strcasecmp(system_charset_info, $1.str, "3") == 0) {
17281 $$ = 3;
17282 } else {
17283 my_error(ER_WRONG_VALUE, MYF(0), "nth factor", $1.str);
17284 MYSQL_YYABORT;
17285 }
17286 }
17287 ;
17288
17289 create_user_list:
17290 create_user
17291 {
17292
2/4
✓ Branch 0 taken 6207 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6207 times.
6207 if (Lex->users_list.push_back($1))
17293 MYSQL_YYABORT;
17294 }
17295 | create_user_list ',' create_user
17296 {
17297
2/4
✓ Branch 0 taken 1225 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1225 times.
1225 if (Lex->users_list.push_back($3))
17298 MYSQL_YYABORT;
17299 }
17300 ;
17301
17302 alter_user_list:
17303 alter_user
17304 {
17305
2/4
✓ Branch 0 taken 1727 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1727 times.
1727 if (Lex->users_list.push_back($1))
17306 MYSQL_YYABORT;
17307 }
17308 | alter_user_list ',' alter_user
17309 {
17310
2/4
✓ Branch 0 taken 389 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 389 times.
389 if (Lex->users_list.push_back($3))
17311 MYSQL_YYABORT;
17312 }
17313 ;
17314
17315 opt_column_list:
17316 9770 /* empty */ { $$= NULL; }
17317 449 | '(' column_list ')' { $$= $2; }
17318 ;
17319
17320 column_list:
17321 ident
17322 {
17323
1/2
✓ Branch 0 taken 449 times.
✗ Branch 1 not taken.
449 $$= NEW_PTN Mem_root_array<LEX_CSTRING>(YYMEM_ROOT);
17324
4/8
✓ Branch 0 taken 449 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 449 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 449 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 449 times.
449 if ($$ == NULL || $$->push_back(to_lex_cstring($1)))
17325 MYSQL_YYABORT; // OOM
17326 }
17327 | column_list ',' ident
17328 {
17329 81 $$= $1;
17330
2/4
✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 81 times.
81 if ($$->push_back(to_lex_cstring($3)))
17331 MYSQL_YYABORT; // OOM
17332 }
17333 ;
17334
17335 require_clause:
17336 /* empty */
17337 | REQUIRE_SYM require_list
17338 {
17339 245 Lex->ssl_type=SSL_TYPE_SPECIFIED;
17340 }
17341 | REQUIRE_SYM SSL_SYM
17342 {
17343 147 Lex->ssl_type=SSL_TYPE_ANY;
17344 }
17345 | REQUIRE_SYM X509_SYM
17346 {
17347 47 Lex->ssl_type=SSL_TYPE_X509;
17348 }
17349 | REQUIRE_SYM NONE_SYM
17350 {
17351 56 Lex->ssl_type=SSL_TYPE_NONE;
17352 }
17353 ;
17354
17355 grant_options:
17356 /* empty */ {}
17357 | WITH GRANT OPTION
17358 1027 { Lex->grant |= GRANT_ACL;}
17359 ;
17360
17361 opt_grant_option:
17362 124 /* empty */ { $$= false; }
17363 288 | WITH GRANT OPTION { $$= true; }
17364 ;
17365 opt_with_roles:
17366 /* empty */
17367 20 { Lex->grant_as.role_type = role_enum::ROLE_NONE; }
17368 | WITH ROLE_SYM role_list
17369 64 { Lex->grant_as.role_type = role_enum::ROLE_NAME;
17370 64 Lex->grant_as.role_list = $3;
17371 }
17372 | WITH ROLE_SYM ALL opt_except_role_list
17373 {
17374 47 Lex->grant_as.role_type = role_enum::ROLE_ALL;
17375 47 Lex->grant_as.role_list = $4;
17376 }
17377 | WITH ROLE_SYM NONE_SYM
17378 293 { Lex->grant_as.role_type = role_enum::ROLE_NONE; }
17379 | WITH ROLE_SYM DEFAULT_SYM
17380 22 { Lex->grant_as.role_type = role_enum::ROLE_DEFAULT; }
17381
17382 opt_grant_as:
17383 /* empty */
17384 9507 { Lex->grant_as.grant_as_used = false; }
17385 | AS user opt_with_roles
17386 {
17387 446 Lex->grant_as.grant_as_used = true;
17388 446 Lex->grant_as.user = $2;
17389 }
17390
17391 begin_stmt:
17392 BEGIN_SYM
17393 {
17394 346961 LEX *lex=Lex;
17395 346961 lex->sql_command = SQLCOM_BEGIN;
17396 346961 lex->start_transaction_opt= 0;
17397 }
17398 opt_work {}
17399 ;
17400
17401 opt_work:
17402 /* empty */ {}
17403 | WORK_SYM {}
17404 ;
17405
17406 opt_chain:
17407 /* empty */
17408 184274 { $$= TVL_UNKNOWN; }
17409 12 | AND_SYM NO_SYM CHAIN_SYM { $$= TVL_NO; }
17410 20 | AND_SYM CHAIN_SYM { $$= TVL_YES; }
17411 ;
17412
17413 opt_release:
17414 /* empty */
17415 184279 { $$= TVL_UNKNOWN; }
17416 7 | RELEASE_SYM { $$= TVL_YES; }
17417 4 | NO_SYM RELEASE_SYM { $$= TVL_NO; }
17418 ;
17419
17420 opt_savepoint:
17421 /* empty */ {}
17422 | SAVEPOINT_SYM {}
17423 ;
17424
17425 commit:
17426 COMMIT_SYM opt_work opt_chain opt_release
17427 {
17428 174973 LEX *lex=Lex;
17429 174973 lex->sql_command= SQLCOM_COMMIT;
17430 /* Don't allow AND CHAIN RELEASE. */
17431
5/6
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 174957 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 15 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
174973 MYSQL_YYABORT_UNLESS($3 != TVL_YES || $4 != TVL_YES);
17432 174972 lex->tx_chain= $3;
17433 174972 lex->tx_release= $4;
17434 }
17435 ;
17436
17437 rollback:
17438 ROLLBACK_SYM opt_work opt_chain opt_release
17439 {
17440 9244 LEX *lex=Lex;
17441 9244 lex->sql_command= SQLCOM_ROLLBACK;
17442 /* Don't allow AND CHAIN RELEASE. */
17443
5/6
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 9240 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
9244 MYSQL_YYABORT_UNLESS($3 != TVL_YES || $4 != TVL_YES);
17444 9243 lex->tx_chain= $3;
17445 9243 lex->tx_release= $4;
17446 }
17447 | ROLLBACK_SYM opt_work
17448 TO_SYM opt_savepoint ident
17449 {
17450 3254 LEX *lex=Lex;
17451 3254 lex->sql_command= SQLCOM_ROLLBACK_TO_SAVEPOINT;
17452 3254 lex->ident= $5;
17453 }
17454 ;
17455
17456 savepoint:
17457 SAVEPOINT_SYM ident
17458 {
17459 6170 LEX *lex=Lex;
17460 6170 lex->sql_command= SQLCOM_SAVEPOINT;
17461 6170 lex->ident= $2;
17462 }
17463 ;
17464
17465 release:
17466 RELEASE_SYM SAVEPOINT_SYM ident
17467 {
17468 85 LEX *lex=Lex;
17469 85 lex->sql_command= SQLCOM_RELEASE_SAVEPOINT;
17470 85 lex->ident= $3;
17471 }
17472 ;
17473
17474 /*
17475 UNIONS : glue selects together
17476 */
17477
17478
17479 union_option:
17480 21609 /* empty */ { $$=1; }
17481 228 | DISTINCT { $$=1; }
17482 41336 | ALL { $$=0; }
17483 ;
17484
17485 row_subquery:
17486 subquery
17487 ;
17488
17489 table_subquery:
17490 subquery
17491 ;
17492
17493 subquery:
17494 query_expression_parens %prec SUBQUERY_AS_EXPR
17495 {
17496
2/4
✓ Branch 0 taken 250922 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 250923 times.
✗ Branch 3 not taken.
250922 $$= NEW_PTN PT_subquery(@$, $1);
17497 }
17498 ;
17499
17500 query_spec_option:
17501 281 STRAIGHT_JOIN { $$= SELECT_STRAIGHT_JOIN; }
17502 29 | HIGH_PRIORITY { $$= SELECT_HIGH_PRIORITY; }
17503 10387 | DISTINCT { $$= SELECT_DISTINCT; }
17504 34 | SQL_SMALL_RESULT { $$= SELECT_SMALL_RESULT; }
17505 75 | SQL_BIG_RESULT { $$= SELECT_BIG_RESULT; }
17506 36 | SQL_BUFFER_RESULT { $$= OPTION_BUFFER_RESULT; }
17507 | SQL_CALC_FOUND_ROWS {
17508
2/4
✓ Branch 0 taken 150 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 150 times.
✗ Branch 3 not taken.
150 push_warning(YYTHD, Sql_condition::SL_WARNING,
17509 ER_WARN_DEPRECATED_SYNTAX,
17510 ER_THD(YYTHD, ER_WARN_DEPRECATED_SQL_CALC_FOUND_ROWS));
17511 150 $$= OPTION_FOUND_ROWS;
17512 }
17513 40 | ALL { $$= SELECT_ALL; }
17514 ;
17515
17516 /**************************************************************************
17517
17518 CREATE VIEW | TRIGGER | PROCEDURE statements.
17519
17520 **************************************************************************/
17521
17522 init_lex_create_info:
17523 /* empty */
17524 {
17525 // Initialize context for 'CREATE view_or_trigger_or_sp_or_event'
17526
1/2
✓ Branch 0 taken 376743 times.
✗ Branch 1 not taken.
376743 Lex->create_info= YYTHD->alloc_typed<HA_CREATE_INFO>();
17527
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 376743 times.
376743 if (Lex->create_info == NULL)
17528 MYSQL_YYABORT; // OOM
17529 }
17530 ;
17531
17532 view_or_trigger_or_sp_or_event:
17533 definer init_lex_create_info definer_tail
17534 {}
17535 | no_definer init_lex_create_info no_definer_tail
17536 {}
17537 | view_replace_or_algorithm definer_opt init_lex_create_info view_tail
17538 {}
17539 ;
17540
17541 definer_tail:
17542 view_tail
17543 | trigger_tail
17544 | sp_tail
17545 | sf_tail
17546 | event_tail
17547 ;
17548
17549 no_definer_tail:
17550 view_tail
17551 | trigger_tail
17552 | sp_tail
17553 | sf_tail
17554 | udf_tail
17555 | event_tail
17556 ;
17557
17558 /**************************************************************************
17559
17560 DEFINER clause support.
17561
17562 **************************************************************************/
17563
17564 definer_opt:
17565 no_definer
17566 | definer
17567 ;
17568
17569 no_definer:
17570 /* empty */
17571 {
17572 /*
17573 We have to distinguish missing DEFINER-clause from case when
17574 CURRENT_USER specified as definer explicitly in order to properly
17575 handle CREATE TRIGGER statements which come to replication thread
17576 from older master servers (i.e. to create non-suid trigger in this
17577 case).
17578 */
17579 28124 YYTHD->lex->definer= 0;
17580 }
17581 ;
17582
17583 definer:
17584 DEFINER_SYM EQ user
17585 {
17586
1/2
✓ Branch 0 taken 357693 times.
✗ Branch 1 not taken.
357693 YYTHD->lex->definer= get_current_user(YYTHD, $3);
17587 }
17588 ;
17589
17590 /**************************************************************************
17591
17592 CREATE VIEW statement parts.
17593
17594 **************************************************************************/
17595
17596 view_replace_or_algorithm:
17597 view_replace
17598 {}
17599 | view_replace view_algorithm
17600 {}
17601 | view_algorithm
17602 {}
17603 ;
17604
17605 view_replace:
17606 OR_SYM REPLACE_SYM
17607 64542 { Lex->create_view_mode= enum_view_create_mode::VIEW_CREATE_OR_REPLACE; }
17608 ;
17609
17610 view_algorithm:
17611 ALGORITHM_SYM EQ UNDEFINED_SYM
17612 760 { Lex->create_view_algorithm= VIEW_ALGORITHM_UNDEFINED; }
17613 | ALGORITHM_SYM EQ MERGE_SYM
17614 26395 { Lex->create_view_algorithm= VIEW_ALGORITHM_MERGE; }
17615 | ALGORITHM_SYM EQ TEMPTABLE_SYM
17616 24770 { Lex->create_view_algorithm= VIEW_ALGORITHM_TEMPTABLE; }
17617 ;
17618
17619 view_suid:
17620 /* empty */
17621 24152 { Lex->create_view_suid= VIEW_SUID_DEFAULT; }
17622 | SQL_SYM SECURITY_SYM DEFINER_SYM
17623 478 { Lex->create_view_suid= VIEW_SUID_DEFINER; }
17624 | SQL_SYM SECURITY_SYM INVOKER_SYM
17625 52703 { Lex->create_view_suid= VIEW_SUID_INVOKER; }
17626 ;
17627
17628 view_tail:
17629 view_suid VIEW_SYM table_ident opt_derived_column_list
17630 {
17631 77270 THD *thd= YYTHD;
17632 77270 LEX *lex= thd->lex;
17633 77270 lex->sql_command= SQLCOM_CREATE_VIEW;
17634 /* first table in list is target VIEW name */
17635
3/4
✓ Branch 0 taken 77270 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 77264 times.
77270 if (!lex->query_block->add_table_to_list(thd, $3, NULL,
17636 TL_OPTION_UPDATING,
17637 TL_IGNORE,
17638 MDL_EXCLUSIVE))
17639 6 MYSQL_YYABORT;
17640 77264 lex->query_tables->open_strategy= TABLE_LIST::OPEN_STUB;
17641 77264 thd->parsing_system_view= lex->query_tables->is_system_view;
17642
2/2
✓ Branch 0 taken 43685 times.
✓ Branch 1 taken 33579 times.
77264 if ($4.size())
17643 {
17644
2/2
✓ Branch 0 taken 420179 times.
✓ Branch 1 taken 43685 times.
463864 for (auto column_alias : $4)
17645 {
17646 // Report error if the column name/length is incorrect.
17647
2/4
✓ Branch 0 taken 420179 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 420179 times.
420179 if (check_column_name(column_alias.str))
17648 {
17649 my_error(ER_WRONG_COLUMN_NAME, MYF(0), column_alias.str);
17650 MYSQL_YYABORT;
17651 }
17652 }
17653 /*
17654 The $4 object is short-lived (its 'm_array' is not);
17655 so we have to duplicate it, and then we can store a
17656 pointer.
17657 */
17658
1/2
✓ Branch 0 taken 43685 times.
✗ Branch 1 not taken.
43685 void *rawmem= thd->memdup(&($4), sizeof($4));
17659
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 43685 times.
43685 if (!rawmem)
17660 MYSQL_YYABORT; /* purecov: inspected */
17661 43685 lex->query_tables->
17662 43685 set_derived_column_names(static_cast<Create_col_name_list* >(rawmem));
17663 }
17664 }
17665 AS view_query_block
17666 ;
17667
17668 view_query_block:
17669 query_expression_or_parens view_check_option
17670 {
17671 77196 THD *thd= YYTHD;
17672 77196 LEX *lex= Lex;
17673 77196 lex->parsing_options.allows_variable= false;
17674 77196 lex->parsing_options.allows_select_into= false;
17675
17676 /*
17677 In CREATE VIEW v ... the table_list initially contains
17678 here a table entry for the destination "table" `v'.
17679 Backup it and clean the table list for the processing of
17680 the query expression and push `v' back to the beginning of the
17681 table_list finally.
17682
17683 @todo: Don't save the CREATE destination table in
17684 Query_block::table_list and remove this backup & restore.
17685
17686 The following work only with the local list, the global list
17687 is created correctly in this case
17688 */
17689
1/2
✓ Branch 0 taken 77196 times.
✗ Branch 1 not taken.
77196 SQL_I_List<TABLE_LIST> save_list;
17690 77196 Query_block * const save_query_block= Select;
17691
1/2
✓ Branch 0 taken 77196 times.
✗ Branch 1 not taken.
77196 save_query_block->table_list.save_and_clear(&save_list);
17692
17693
9/14
✓ Branch 0 taken 77196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77196 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 77196 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 77196 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 77196 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 244 times.
✓ Branch 11 taken 76952 times.
✓ Branch 12 taken 244 times.
✓ Branch 13 taken 76952 times.
77196 CONTEXTUALIZE($1);
17694
17695 /*
17696 The following work only with the local list, the global list
17697 is created correctly in this case
17698 */
17699 76952 save_query_block->table_list.push_front(&save_list);
17700
17701 76952 Lex->create_view_check= $2;
17702
17703 /*
17704 It's simpler to use @$ to grab the whole rule text, OTOH it's
17705 also simple to lose something that way when changing this rule,
17706 so let use explicit @1 and @2 to memdup this view definition:
17707 */
17708 76952 const size_t len= @2.cpp.end - @1.cpp.start;
17709 76952 lex->create_view_query_block.str=
17710
1/2
✓ Branch 0 taken 76952 times.
✗ Branch 1 not taken.
76952 static_cast<char *>(thd->memdup(@1.cpp.start, len));
17711 76952 lex->create_view_query_block.length= len;
17712
1/2
✓ Branch 0 taken 76952 times.
✗ Branch 1 not taken.
76952 trim_whitespace(thd->charset(), &lex->create_view_query_block);
17713
17714 76952 lex->parsing_options.allows_variable= true;
17715 76952 lex->parsing_options.allows_select_into= true;
17716 }
17717 ;
17718
17719 view_check_option:
17720 76899 /* empty */ { $$= VIEW_CHECK_NONE; }
17721 96 | WITH CHECK_SYM OPTION { $$= VIEW_CHECK_CASCADED; }
17722 104 | WITH CASCADED CHECK_SYM OPTION { $$= VIEW_CHECK_CASCADED; }
17723 97 | WITH LOCAL_SYM CHECK_SYM OPTION { $$= VIEW_CHECK_LOCAL; }
17724 ;
17725
17726 /**************************************************************************
17727
17728 CREATE TRIGGER statement parts.
17729
17730 **************************************************************************/
17731
17732 trigger_action_order:
17733 FOLLOWS_SYM
17734 17 { $$= TRG_ORDER_FOLLOWS; }
17735 | PRECEDES_SYM
17736 19 { $$= TRG_ORDER_PRECEDES; }
17737 ;
17738
17739 trigger_follows_precedes_clause:
17740 /* empty */
17741 {
17742 46793 $$.ordering_clause= TRG_ORDER_NONE;
17743 46793 $$.anchor_trigger_name= NULL_CSTR;
17744 }
17745 |
17746 trigger_action_order ident_or_text
17747 {
17748 36 $$.ordering_clause= $1;
17749 36 $$.anchor_trigger_name= { $2.str, $2.length };
17750 }
17751 ;
17752
17753 trigger_tail:
17754 TRIGGER_SYM /* $1 */
17755 opt_if_not_exists /* $2 */
17756 sp_name /* $3 */
17757 trg_action_time /* $4 */
17758 trg_event /* $5 */
17759 ON_SYM /* $6 */
17760 table_ident /* $7 */
17761 FOR_SYM /* $8 */
17762 EACH_SYM /* $9 */
17763 ROW_SYM /* $10 */
17764 trigger_follows_precedes_clause /* $11 */
17765 { /* $12 */
17766 46830 THD *thd= YYTHD;
17767 46830 LEX *lex= thd->lex;
17768
17769
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 46828 times.
46830 if (lex->sphead)
17770 {
17771
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "TRIGGER");
17772 2 MYSQL_YYABORT;
17773 }
17774
17775
1/2
✓ Branch 0 taken 46828 times.
✗ Branch 1 not taken.
46828 sp_head *sp= sp_start_parsing(thd, enum_sp_type::TRIGGER, $3);
17776
17777
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 46828 times.
46828 if (!sp)
17778 MYSQL_YYABORT;
17779
17780 46828 sp->m_trg_chistics.action_time= (enum enum_trigger_action_time_type) $4;
17781 46828 sp->m_trg_chistics.event= (enum enum_trigger_event_type) $5;
17782 46828 sp->m_trg_chistics.ordering_clause= $11.ordering_clause;
17783 46828 sp->m_trg_chistics.anchor_trigger_name= $11.anchor_trigger_name;
17784
17785 46828 lex->stmt_definition_begin= @1.cpp.start;
17786
2/2
✓ Branch 0 taken 15 times.
✓ Branch 1 taken 46813 times.
46828 lex->create_info->options= $2 ? HA_LEX_CREATE_IF_NOT_EXISTS : 0;
17787 46828 lex->ident.str= const_cast<char *>(@7.cpp.start);
17788 46828 lex->ident.length= @9.cpp.start - @7.cpp.start;
17789
17790 46828 lex->sphead= sp;
17791 46828 lex->spname= $3;
17792
17793 46828 memset(&lex->sp_chistics, 0, sizeof(st_sp_chistics));
17794 46828 sp->m_chistics= &lex->sp_chistics;
17795
1/2
✓ Branch 0 taken 46828 times.
✗ Branch 1 not taken.
46828 sp->set_body_start(thd, @11.cpp.end);
17796 }
17797 sp_proc_stmt /* $13 */
17798 { /* $14 */
17799 46700 THD *thd= YYTHD;
17800 46700 LEX *lex= Lex;
17801 46700 sp_head *sp= lex->sphead;
17802
17803
1/2
✓ Branch 0 taken 46701 times.
✗ Branch 1 not taken.
46700 sp_finish_parsing(thd);
17804
17805 46701 lex->sql_command= SQLCOM_CREATE_TRIGGER;
17806
17807
3/4
✓ Branch 0 taken 46700 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48 times.
✓ Branch 3 taken 46652 times.
46701 if (sp->is_not_allowed_in_function("trigger"))
17808 48 MYSQL_YYABORT;
17809
17810 /*
17811 We have to do it after parsing trigger body, because some of
17812 sp_proc_stmt alternatives are not saving/restoring LEX, so
17813 lex->query_tables can be wiped out.
17814 */
17815
3/4
✓ Branch 0 taken 46652 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 46646 times.
46652 if (!lex->query_block->add_table_to_list(thd, $7,
17816 nullptr,
17817 TL_OPTION_UPDATING,
17818 TL_READ_NO_INSERT,
17819 MDL_SHARED_NO_WRITE))
17820 6 MYSQL_YYABORT;
17821
17822
1/2
✓ Branch 0 taken 46648 times.
✗ Branch 1 not taken.
93292 Lex->m_sql_cmd= new (YYTHD->mem_root) Sql_cmd_create_trigger();
17823 }
17824 ;
17825
17826 /**************************************************************************
17827
17828 CREATE FUNCTION | PROCEDURE statements parts.
17829
17830 **************************************************************************/
17831
17832 udf_tail:
17833 AGGREGATE_SYM /* $1 */
17834 FUNCTION_SYM /* $2 */
17835 opt_if_not_exists /* $3 */
17836 ident /* $4 */
17837 RETURNS_SYM /* $5 */
17838 udf_type /* $6 */
17839 SONAME_SYM /* $7 */
17840 TEXT_STRING_sys /* $8 */
17841 { /* $9 */
17842 6 THD *thd= YYTHD;
17843 6 LEX *lex= thd->lex;
17844
17845
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
6 if (is_native_function($4))
17846 {
17847 if($3)
17848 {
17849 /*
17850 IF NOT EXISTS clause is unsupported when creating a UDF with
17851 the same name as a native function
17852 */
17853 my_error(ER_IF_NOT_EXISTS_UNSUPPORTED_UDF_NATIVE_FCT_NAME_COLLISION, MYF(0), $4.str);
17854 }
17855 else
17856 my_error(ER_NATIVE_FCT_NAME_COLLISION, MYF(0), $4.str);
17857 MYSQL_YYABORT;
17858 }
17859 6 lex->sql_command = SQLCOM_CREATE_FUNCTION;
17860 6 lex->udf.type= UDFTYPE_AGGREGATE;
17861 6 lex->stmt_definition_begin= @2.cpp.start;
17862
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 lex->create_info->options= $3 ? HA_LEX_CREATE_IF_NOT_EXISTS : 0;
17863 6 lex->udf.name = $4;
17864 6 lex->udf.returns=(Item_result) $6;
17865 6 lex->udf.dl=$8.str;
17866 }
17867 | FUNCTION_SYM /* $1 */
17868 opt_if_not_exists /* $2 */
17869 ident /* $3 */
17870 RETURNS_SYM /* $4 */
17871 udf_type /* $5 */
17872 SONAME_SYM /* $6 */
17873 TEXT_STRING_sys /* $7 */
17874 {
17875 669 THD *thd= YYTHD;
17876 669 LEX *lex= thd->lex;
17877
17878
3/4
✓ Branch 0 taken 669 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 667 times.
669 if (is_native_function($3))
17879 {
17880
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
2 if($2)
17881 {
17882 /*
17883 IF NOT EXISTS clause is unsupported when creating a UDF with
17884 the same name as a native function
17885 */
17886
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_IF_NOT_EXISTS_UNSUPPORTED_UDF_NATIVE_FCT_NAME_COLLISION, MYF(0), $3.str);
17887 }
17888 else
17889
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_NATIVE_FCT_NAME_COLLISION, MYF(0), $3.str);
17890 2 MYSQL_YYABORT;
17891 }
17892 667 lex->sql_command = SQLCOM_CREATE_FUNCTION;
17893 667 lex->udf.type= UDFTYPE_FUNCTION;
17894 667 lex->stmt_definition_begin= @1.cpp.start;
17895
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 653 times.
667 lex->create_info->options= $2 ? HA_LEX_CREATE_IF_NOT_EXISTS : 0;
17896 667 lex->udf.name = $3;
17897 667 lex->udf.returns=(Item_result) $5;
17898 667 lex->udf.dl=$7.str;
17899 }
17900 ;
17901
17902 sf_tail:
17903 FUNCTION_SYM /* $1 */
17904 opt_if_not_exists /* $2 */
17905 sp_name /* $3 */
17906 '(' /* $4 */
17907 { /* $5 */
17908 87575 THD *thd= YYTHD;
17909 87575 LEX *lex= thd->lex;
17910
17911 87575 lex->stmt_definition_begin= @1.cpp.start;
17912 87575 lex->spname= $3;
17913
17914
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 87572 times.
87575 if (lex->sphead)
17915 {
17916
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "FUNCTION");
17917 3 MYSQL_YYABORT;
17918 }
17919
17920
17921
1/2
✓ Branch 0 taken 87572 times.
✗ Branch 1 not taken.
87572 sp_head *sp= sp_start_parsing(thd, enum_sp_type::FUNCTION, lex->spname);
17922
17923
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 87572 times.
87572 if (!sp)
17924 MYSQL_YYABORT;
17925
17926 87572 lex->sphead= sp;
17927
2/2
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 87555 times.
87572 lex->create_info->options= $2 ? HA_LEX_CREATE_IF_NOT_EXISTS : 0;
17928
17929 87572 sp->m_parser_data.set_parameter_start_ptr(@4.cpp.end);
17930 }
17931 sp_fdparam_list /* $6 */
17932 ')' /* $7 */
17933 { /* $8 */
17934 87544 Lex->sphead->m_parser_data.set_parameter_end_ptr(@7.cpp.start);
17935 }
17936 RETURNS_SYM /* $9 */
17937 type /* $10 */
17938 opt_collate /* $11 */
17939 { /* $12 */
17940 87541 LEX *lex= Lex;
17941 87541 sp_head *sp= lex->sphead;
17942
17943
7/14
✓ Branch 0 taken 87541 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 87541 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 87541 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 87541 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 87541 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 87541 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 87541 times.
87541 CONTEXTUALIZE($10);
17944 87541 enum_field_types field_type= $10->type;
17945
1/2
✓ Branch 0 taken 87541 times.
✗ Branch 1 not taken.
87541 const CHARSET_INFO *cs= $10->get_charset();
17946
3/4
✓ Branch 0 taken 87541 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 87540 times.
87541 if (merge_sp_var_charset_and_collation(cs, $11, &cs))
17947 1 MYSQL_YYABORT;
17948
17949 /*
17950 This was disabled in 5.1.12. See bug #20701
17951 When collation support in SP is implemented, then this test
17952 should be removed.
17953 */
17954
2/2
✓ Branch 0 taken 33805 times.
✓ Branch 1 taken 53468 times.
87273 if ((field_type == MYSQL_TYPE_STRING || field_type == MYSQL_TYPE_VARCHAR)
17955
7/8
✓ Branch 0 taken 87273 times.
✓ Branch 1 taken 267 times.
✓ Branch 2 taken 34072 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 34069 times.
✓ Branch 6 taken 3 times.
✓ Branch 7 taken 87537 times.
174813 && ($10->get_type_flags() & BINCMP_FLAG))
17956 {
17957
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 my_error(ER_NOT_SUPPORTED_YET, MYF(0), "return value collation");
17958 3 MYSQL_YYABORT;
17959 }
17960
17961
2/4
✓ Branch 0 taken 87537 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 87537 times.
262611 if (sp->m_return_field_def.init(YYTHD, "", field_type,
17962
1/2
✓ Branch 0 taken 87537 times.
✗ Branch 1 not taken.
87537 $10->get_length(), $10->get_dec(),
17963
2/4
✓ Branch 0 taken 87537 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 87537 times.
✗ Branch 3 not taken.
87537 $10->get_type_flags(), NULL, NULL, &NULL_CSTR, 0,
17964
1/2
✓ Branch 0 taken 87537 times.
✗ Branch 1 not taken.
87537 $10->get_interval_list(),
17965 87537 cs ? cs : YYTHD->variables.collation_database,
17966
3/4
✓ Branch 0 taken 87537 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 22455 times.
✓ Branch 3 taken 65082 times.
87537 $11 != nullptr, $10->get_uint_geom_type(), nullptr,
17967 nullptr, nullptr, {},
17968 dd::Column::enum_hidden_type::HT_VISIBLE))
17969 {
17970 MYSQL_YYABORT;
17971 }
17972
17973
2/4
✓ Branch 0 taken 87537 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 87537 times.
87537 if (prepare_sp_create_field(YYTHD,
17974 &sp->m_return_field_def))
17975 MYSQL_YYABORT;
17976
17977 87537 memset(&lex->sp_chistics, 0, sizeof(st_sp_chistics));
17978 }
17979 sp_c_chistics /* $13 */
17980 { /* $14 */
17981 87536 THD *thd= YYTHD;
17982 87536 LEX *lex= thd->lex;
17983
17984 87536 lex->sphead->m_chistics= &lex->sp_chistics;
17985
1/2
✓ Branch 0 taken 87536 times.
✗ Branch 1 not taken.
87536 lex->sphead->set_body_start(thd, yylloc.cpp.start);
17986 }
17987 sp_proc_stmt /* $15 */
17988 {
17989 87501 THD *thd= YYTHD;
17990 87501 LEX *lex= thd->lex;
17991 87501 sp_head *sp= lex->sphead;
17992
17993
3/4
✓ Branch 0 taken 87501 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 90 times.
✓ Branch 3 taken 87411 times.
87501 if (sp->is_not_allowed_in_function("function"))
17994 90 MYSQL_YYABORT;
17995
17996
1/2
✓ Branch 0 taken 87411 times.
✗ Branch 1 not taken.
87411 sp_finish_parsing(thd);
17997
17998 87411 lex->sql_command= SQLCOM_CREATE_SPFUNCTION;
17999
18000
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 87410 times.
87411 if (!(sp->m_flags & sp_head::HAS_RETURN))
18001 {
18002
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_SP_NORETURN, MYF(0), sp->m_qname.str);
18003 1 MYSQL_YYABORT;
18004 }
18005
18006
3/4
✓ Branch 0 taken 87410 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4510 times.
✓ Branch 3 taken 82900 times.
87410 if (is_native_function(sp->m_name))
18007 {
18008 /*
18009 This warning will be printed when
18010 [1] A client query is parsed,
18011 [2] A stored function is loaded by db_load_routine.
18012 Printing the warning for [2] is intentional, to cover the
18013 following scenario:
18014 - A user define a SF 'foo' using MySQL 5.N
18015 - An application uses select foo(), and works.
18016 - MySQL 5.{N+1} defines a new native function 'foo', as
18017 part of a new feature.
18018 - MySQL 5.{N+1} documentation is updated, and should mention
18019 that there is a potential incompatible change in case of
18020 existing stored function named 'foo'.
18021 - The user deploys 5.{N+1}. At this point, 'select foo()'
18022 means something different, and the user code is most likely
18023 broken (it's only safe if the code is 'select db.foo()').
18024 With a warning printed when the SF is loaded (which has to occur
18025 before the call), the warning will provide a hint explaining
18026 the root cause of a later failure of 'select foo()'.
18027 With no warning printed, the user code will fail with no
18028 apparent reason.
18029 Printing a warning each time db_load_routine is executed for
18030 an ambiguous function is annoying, since that can happen a lot,
18031 but in practice should not happen unless there *are* name
18032 collisions.
18033 If a collision exists, it should not be silenced but fixed.
18034 */
18035
2/4
✓ Branch 0 taken 4510 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4510 times.
✗ Branch 3 not taken.
4510 push_warning_printf(thd,
18036 Sql_condition::SL_NOTE,
18037 ER_NATIVE_FCT_NAME_COLLISION,
18038 ER_THD(thd, ER_NATIVE_FCT_NAME_COLLISION),
18039 sp->m_name.str);
18040 }
18041 }
18042 ;
18043
18044 sp_tail:
18045 PROCEDURE_SYM /*$1*/
18046 opt_if_not_exists /*$2*/
18047 sp_name /*$3*/
18048 { /*$4*/
18049 171842 THD *thd= YYTHD;
18050 171842 LEX *lex= Lex;
18051
18052
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 171841 times.
171842 if (lex->sphead)
18053 {
18054
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "PROCEDURE");
18055 1 MYSQL_YYABORT;
18056 }
18057
18058 171841 lex->stmt_definition_begin= @1.cpp.start;
18059
18060
1/2
✓ Branch 0 taken 171842 times.
✗ Branch 1 not taken.
171841 sp_head *sp= sp_start_parsing(thd, enum_sp_type::PROCEDURE, $3);
18061
18062
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 171842 times.
171842 if (!sp)
18063 MYSQL_YYABORT;
18064
18065 171842 lex->sphead= sp;
18066
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 171828 times.
171842 lex->create_info->options= $2 ? HA_LEX_CREATE_IF_NOT_EXISTS : 0;
18067 }
18068 '(' /*$5*/
18069 { /*$6*/
18070 171841 Lex->sphead->m_parser_data.set_parameter_start_ptr(@5.cpp.end);
18071 }
18072 sp_pdparam_list /*$7*/
18073 ')' /*$8*/
18074 { /*$9*/
18075 171833 THD *thd= YYTHD;
18076 171833 LEX *lex= thd->lex;
18077
18078 171833 lex->sphead->m_parser_data.set_parameter_end_ptr(@8.cpp.start);
18079 171833 memset(&lex->sp_chistics, 0, sizeof(st_sp_chistics));
18080 }
18081 sp_c_chistics /*$10*/
18082 { /*$11*/
18083 171830 THD *thd= YYTHD;
18084 171830 LEX *lex= thd->lex;
18085
18086 171830 lex->sphead->m_chistics= &lex->sp_chistics;
18087
1/2
✓ Branch 0 taken 171829 times.
✗ Branch 1 not taken.
171830 lex->sphead->set_body_start(thd, yylloc.cpp.start);
18088 }
18089 sp_proc_stmt /*$12*/
18090 { /*$13*/
18091 170277 THD *thd= YYTHD;
18092 170277 LEX *lex= Lex;
18093
18094
1/2
✓ Branch 0 taken 170276 times.
✗ Branch 1 not taken.
170277 sp_finish_parsing(thd);
18095
18096 170276 lex->sql_command= SQLCOM_CREATE_PROCEDURE;
18097 }
18098 ;
18099
18100 /*************************************************************************/
18101
18102 xa:
18103 XA_SYM begin_or_start xid opt_join_or_resume
18104 {
18105 909 Lex->sql_command = SQLCOM_XA_START;
18106
2/4
✓ Branch 0 taken 909 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 909 times.
✗ Branch 3 not taken.
909 Lex->m_sql_cmd= NEW_PTN Sql_cmd_xa_start($3, $4);
18107 }
18108 | XA_SYM END xid opt_suspend
18109 {
18110 876 Lex->sql_command = SQLCOM_XA_END;
18111
2/4
✓ Branch 0 taken 876 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 876 times.
✗ Branch 3 not taken.
876 Lex->m_sql_cmd= NEW_PTN Sql_cmd_xa_end($3, $4);
18112 }
18113 | XA_SYM PREPARE_SYM xid
18114 {
18115 409 Lex->sql_command = SQLCOM_XA_PREPARE;
18116
2/4
✓ Branch 0 taken 409 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 409 times.
✗ Branch 3 not taken.
409 Lex->m_sql_cmd= NEW_PTN Sql_cmd_xa_prepare($3);
18117 }
18118 | XA_SYM COMMIT_SYM xid opt_one_phase
18119 {
18120 585 Lex->sql_command = SQLCOM_XA_COMMIT;
18121
2/4
✓ Branch 0 taken 585 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 585 times.
✗ Branch 3 not taken.
585 Lex->m_sql_cmd= NEW_PTN Sql_cmd_xa_commit($3, $4);
18122 }
18123 | XA_SYM ROLLBACK_SYM xid
18124 {
18125 272 Lex->sql_command = SQLCOM_XA_ROLLBACK;
18126
2/4
✓ Branch 0 taken 272 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 272 times.
✗ Branch 3 not taken.
272 Lex->m_sql_cmd= NEW_PTN Sql_cmd_xa_rollback($3);
18127 }
18128 | XA_SYM RECOVER_SYM opt_convert_xid
18129 {
18130 253 Lex->sql_command = SQLCOM_XA_RECOVER;
18131
2/4
✓ Branch 0 taken 253 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 253 times.
✗ Branch 3 not taken.
253 Lex->m_sql_cmd= NEW_PTN Sql_cmd_xa_recover($3);
18132 }
18133 ;
18134
18135 opt_convert_xid:
18136 249 /* empty */ { $$= false; }
18137 4 | CONVERT_SYM XID_SYM { $$= true; }
18138
18139 xid:
18140 text_string
18141 {
18142
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1730 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1731 MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE);
18143 XID *xid;
18144
2/4
✓ Branch 0 taken 1730 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1730 times.
1730 if (!(xid= (XID *)YYTHD->alloc(sizeof(XID))))
18145 MYSQL_YYABORT;
18146
1/2
✓ Branch 0 taken 1730 times.
✗ Branch 1 not taken.
1730 xid->set(1L, $1->ptr(), $1->length(), 0, 0);
18147 1730 $$= xid;
18148 }
18149 | text_string ',' text_string
18150 {
18151
3/8
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 37 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 37 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
37 MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE &&
18152 $3->length() <= MAXBQUALSIZE);
18153 XID *xid;
18154
2/4
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 37 times.
37 if (!(xid= (XID *)YYTHD->alloc(sizeof(XID))))
18155 MYSQL_YYABORT;
18156
1/2
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
37 xid->set(1L, $1->ptr(), $1->length(), $3->ptr(), $3->length());
18157 37 $$= xid;
18158 }
18159 | text_string ',' text_string ',' ulong_num
18160 {
18161 // check for overwflow of xid format id
18162 1286 bool format_id_overflow_detected= ($5 > LONG_MAX);
18163
18164
7/10
✓ Branch 0 taken 1286 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1286 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 1284 times.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 1284 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
1286 MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE &&
18165 $3->length() <= MAXBQUALSIZE
18166 && !format_id_overflow_detected);
18167
18168 XID *xid;
18169
2/4
✓ Branch 0 taken 1284 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1284 times.
1284 if (!(xid= (XID *)YYTHD->alloc(sizeof(XID))))
18170 MYSQL_YYABORT;
18171
1/2
✓ Branch 0 taken 1284 times.
✗ Branch 1 not taken.
1284 xid->set($5, $1->ptr(), $1->length(), $3->ptr(), $3->length());
18172 1284 $$= xid;
18173 }
18174 ;
18175
18176 begin_or_start:
18177 BEGIN_SYM {}
18178 | START_SYM {}
18179 ;
18180
18181 opt_join_or_resume:
18182 903 /* nothing */ { $$= XA_NONE; }
18183 | JOIN_SYM { $$= XA_JOIN; }
18184 6 | RESUME_SYM { $$= XA_RESUME; }
18185 ;
18186
18187 opt_one_phase:
18188 517 /* nothing */ { $$= XA_NONE; }
18189 68 | ONE_SYM PHASE_SYM { $$= XA_ONE_PHASE; }
18190 ;
18191
18192 opt_suspend:
18193 /* nothing */
18194 874 { $$= XA_NONE; }
18195 | SUSPEND_SYM
18196 2 { $$= XA_SUSPEND; }
18197 | SUSPEND_SYM FOR_SYM MIGRATE_SYM
18198 { $$= XA_FOR_MIGRATE; }
18199 ;
18200
18201 install:
18202 INSTALL_SYM PLUGIN_SYM ident SONAME_SYM TEXT_STRING_sys
18203 {
18204 923 LEX *lex= Lex;
18205 923 lex->sql_command= SQLCOM_INSTALL_PLUGIN;
18206
1/2
✓ Branch 0 taken 923 times.
✗ Branch 1 not taken.
923 lex->m_sql_cmd= new (YYMEM_ROOT) Sql_cmd_install_plugin(to_lex_cstring($3), $5);
18207 }
18208 | INSTALL_SYM COMPONENT_SYM TEXT_STRING_sys_list
18209 {
18210 495 LEX *lex= Lex;
18211 495 lex->sql_command= SQLCOM_INSTALL_COMPONENT;
18212
1/2
✓ Branch 0 taken 495 times.
✗ Branch 1 not taken.
495 lex->m_sql_cmd= new (YYMEM_ROOT) Sql_cmd_install_component($3);
18213 }
18214 ;
18215
18216 uninstall:
18217 UNINSTALL_SYM PLUGIN_SYM ident
18218 {
18219 1054 LEX *lex= Lex;
18220 1054 lex->sql_command= SQLCOM_UNINSTALL_PLUGIN;
18221
1/2
✓ Branch 0 taken 1054 times.
✗ Branch 1 not taken.
1054 lex->m_sql_cmd= new (YYMEM_ROOT) Sql_cmd_uninstall_plugin(to_lex_cstring($3));
18222 }
18223 | UNINSTALL_SYM COMPONENT_SYM TEXT_STRING_sys_list
18224 {
18225 498 LEX *lex= Lex;
18226 498 lex->sql_command= SQLCOM_UNINSTALL_COMPONENT;
18227
1/2
✓ Branch 0 taken 498 times.
✗ Branch 1 not taken.
498 lex->m_sql_cmd= new (YYMEM_ROOT) Sql_cmd_uninstall_component($3);
18228 }
18229 ;
18230
18231 TEXT_STRING_sys_list:
18232 TEXT_STRING_sys
18233 {
18234 1029 $$.init(YYTHD->mem_root);
18235
2/4
✓ Branch 0 taken 1029 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1029 times.
1029 if ($$.push_back($1))
18236 MYSQL_YYABORT; // OOM
18237 }
18238 | TEXT_STRING_sys_list ',' TEXT_STRING_sys
18239 {
18240 55 $$= $1;
18241
2/4
✓ Branch 0 taken 55 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 55 times.
55 if ($$.push_back($3))
18242 MYSQL_YYABORT; // OOM
18243 }
18244 ;
18245
18246 import_stmt:
18247 IMPORT TABLE_SYM FROM TEXT_STRING_sys_list
18248 {
18249 36 LEX *lex= Lex;
18250 36 lex->m_sql_cmd=
18251
2/4
✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
✗ Branch 3 not taken.
36 new (YYTHD->mem_root) Sql_cmd_import_table($4);
18252
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 36 times.
36 if (lex->m_sql_cmd == NULL)
18253 MYSQL_YYABORT;
18254 36 lex->sql_command= SQLCOM_IMPORT;
18255 }
18256 ;
18257
18258 /**************************************************************************
18259
18260 Clone local/remote replica statements.
18261
18262 **************************************************************************/
18263 clone_stmt:
18264 CLONE_SYM LOCAL_SYM
18265 DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_filesystem
18266 {
18267 146 Lex->sql_command= SQLCOM_CLONE;
18268
1/2
✓ Branch 0 taken 146 times.
✗ Branch 1 not taken.
146 Lex->m_sql_cmd= NEW_PTN Sql_cmd_clone(to_lex_cstring($6));
18269
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 146 times.
146 if (Lex->m_sql_cmd == nullptr)
18270 MYSQL_YYABORT;
18271 }
18272
18273 | CLONE_SYM INSTANCE_SYM FROM user ':' ulong_num
18274 IDENTIFIED_SYM BY TEXT_STRING_sys
18275 opt_datadir_ssl
18276 {
18277 211 Lex->sql_command= SQLCOM_CLONE;
18278 /* Reject space characters around ':' */
18279
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 211 times.
211 if (@6.raw.start - @4.raw.end != 1) {
18280 YYTHD->syntax_error_at(@5);
18281 MYSQL_YYABORT;
18282 }
18283 211 $4->first_factor_auth_info.auth = to_lex_cstring($9);
18284 211 $4->first_factor_auth_info.uses_identified_by_clause = true;
18285 211 Lex->contains_plaintext_password= true;
18286
18287
2/4
✓ Branch 0 taken 211 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 211 times.
✗ Branch 3 not taken.
211 Lex->m_sql_cmd= NEW_PTN Sql_cmd_clone($4, $6, to_lex_cstring($10));
18288
18289
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 211 times.
211 if (Lex->m_sql_cmd == nullptr)
18290 MYSQL_YYABORT;
18291 }
18292 ;
18293
18294 opt_datadir_ssl:
18295 opt_ssl
18296 {
18297 72 $$= null_lex_str;
18298 }
18299 | DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_filesystem opt_ssl
18300 {
18301 139 $$= $4;
18302 }
18303 ;
18304
18305 opt_ssl:
18306 /* empty */
18307 {
18308 153 Lex->ssl_type= SSL_TYPE_NOT_SPECIFIED;
18309 }
18310 | REQUIRE_SYM SSL_SYM
18311 {
18312 6 Lex->ssl_type= SSL_TYPE_SPECIFIED;
18313 }
18314 | REQUIRE_SYM NO_SYM SSL_SYM
18315 {
18316 52 Lex->ssl_type= SSL_TYPE_NONE;
18317 }
18318 ;
18319
18320 resource_group_types:
18321 23 USER { $$= resourcegroups::Type::USER_RESOURCE_GROUP; }
18322 1 | SYSTEM_SYM { $$= resourcegroups::Type::SYSTEM_RESOURCE_GROUP; }
18323 ;
18324
18325 opt_resource_group_vcpu_list:
18326 /* empty */
18327 {
18328 /* Make an empty list. */
18329
2/4
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
12 $$= NEW_PTN Mem_root_array<resourcegroups::Range>(YYMEM_ROOT);
18330
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
12 if ($$ == nullptr)
18331 MYSQL_YYABORT;
18332 }
18333 30 | VCPU_SYM opt_equal vcpu_range_spec_list { $$= $3; }
18334 ;
18335
18336 vcpu_range_spec_list:
18337 vcpu_num_or_range
18338 {
18339 30 resourcegroups::Range r($1.start, $1.end);
18340
2/4
✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 30 times.
✗ Branch 3 not taken.
30 $$= NEW_PTN Mem_root_array<resourcegroups::Range>(YYMEM_ROOT);
18341
4/8
✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 30 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 30 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 30 times.
30 if ($$ == nullptr || $$->push_back(r))
18342 MYSQL_YYABORT;
18343 }
18344 | vcpu_range_spec_list opt_comma vcpu_num_or_range
18345 {
18346 2 resourcegroups::Range r($3.start, $3.end);
18347 2 $$= $1;
18348
4/8
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
2 if ($$ == nullptr || $$->push_back(r))
18349 MYSQL_YYABORT;
18350 }
18351 ;
18352
18353 vcpu_num_or_range:
18354 NUM
18355 {
18356 13 auto cpu_id= my_strtoull($1.str, nullptr, 10);
18357 13 $$.start= $$.end=
18358 static_cast<resourcegroups::platform::cpu_id_t>(cpu_id);
18359
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
13 assert($$.start == cpu_id); // truncation check
18360 }
18361 | NUM '-' NUM
18362 {
18363 19 auto start= my_strtoull($1.str, nullptr, 10);
18364 19 $$.start= static_cast<resourcegroups::platform::cpu_id_t>(start);
18365
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
19 assert($$.start == start); // truncation check
18366
18367 19 auto end= my_strtoull($3.str, nullptr, 10);
18368 19 $$.end= static_cast<resourcegroups::platform::cpu_id_t>(end);
18369
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
19 assert($$.end == end); // truncation check
18370 }
18371 ;
18372
18373 signed_num:
18374 11 NUM { $$= static_cast<int>(my_strtoll($1.str, nullptr, 10)); }
18375 3 | '-' NUM { $$= -static_cast<int>(my_strtoll($2.str, nullptr, 10)); }
18376 ;
18377
18378 opt_resource_group_priority:
18379 28 /* empty */ { $$.is_default= true; }
18380 | THREAD_PRIORITY_SYM opt_equal signed_num
18381 {
18382 14 $$.is_default= false;
18383 14 $$.value= $3;
18384 }
18385 ;
18386
18387 opt_resource_group_enable_disable:
18388 36 /* empty */ { $$.is_default= true; }
18389 | ENABLE_SYM
18390 {
18391 1 $$.is_default= false;
18392 1 $$.value= true;
18393 }
18394 | DISABLE_SYM
18395 {
18396 5 $$.is_default= false;
18397 5 $$.value= false;
18398 }
18399 ;
18400
18401 opt_force:
18402 29 /* empty */ { $$= false; }
18403 9 | FORCE_SYM { $$= true; }
18404 ;
18405
18406
18407 json_attribute:
18408 TEXT_STRING_sys
18409 {
18410
2/2
✓ Branch 0 taken 210 times.
✓ Branch 1 taken 9 times.
219 if ($1.str[0] != '\0') {
18411 210 size_t eoff = 0;
18412 210 std::string emsg;
18413
3/4
✓ Branch 0 taken 210 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 200 times.
210 if (!is_valid_json_syntax($1.str, $1.length, &eoff, &emsg,
18414 JsonDocumentDefaultDepthHandler)) {
18415
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 my_error(ER_INVALID_JSON_ATTRIBUTE, MYF(0),
18416 10 emsg.c_str(), eoff, $1.str+eoff);
18417 10 MYSQL_YYABORT;
18418 }
18419
2/2
✓ Branch 0 taken 200 times.
✓ Branch 1 taken 10 times.
210 }
18420 209 $$ = to_lex_cstring($1);
18421 }
18422
18423 /**
18424 @} (end of group Parser)
18425 */
18426